Babysitter docs
Everything you need to install, run, and tune Babysitter. The source of truth is the README and src/policy.js.
Overview
Babysitter classifies each prompt with Jev, applies a small routing policy you can read, and runs that prompt on the right model.
It adds two new commands and leaves the official ones alone:
bbs-codex # a routed Codex session
bbs-claude # a routed Claude Code session
codex # normal Codex
claude # normal Claude Code- It makes a new model decision for every prompt, not once per session.
- It keeps the conversation and avoids wasteful Claude model switches.
- Before each answer it shows a route card: tier, model, effort, reason, and Jev token use.
- The routing rules are plain code in
src/policy.js.
YOU ❯ Fix the typo in README
╭─ ROUTE ◆ LUNA
│ Model gpt-5.6-luna
│ Effort low
│ Confidence 94%
│ Clarify 3% needs-user-decision probability
│ Why complexity=0/3
│ Router Jev · 143 input tokens
╰──────────────────────────────────────────────
╭─ CODEX
Updated README.md.
╰─ ✓ Complete · gpt-5.6-luna · 2.1sInstall
You need
- Node.js 20 or later
- A TypeSafe API key for Jev
- The official Codex CLI and/or Claude Code CLI
- You are signed in to each CLI you plan to use
Install Babysitter
git clone https://github.com/divyansharma001/babysitter.git
cd babysitter
cp .env.example .env
# add your own TYPESAFE_API_KEY to .env
npm install
npm linknpm link adds bbs-codex, bbs-claude, and bbs-update to your terminal. Your .env stays on your machine. Never commit it.
Start a session
bbs-codex
# or
bbs-claudeYou can pass the first prompt straight away:
bbs-codex "Find and fix the race condition in the payment worker"
bbs-claude "Find and fix the race condition in the payment worker"- This still opens the interactive routed session.
- If Claude asks a question or needs approval, answer in the same terminal and the turn continues.
- Type
/exitor/quitto leave.
Attach images
Routed Claude and Codex sessions accept images:
/paste
# attaches the image on the macOS clipboard
/image ./screenshots/error.png
# attaches a PNG, JPEG, GIF, or WebP file- After attaching, type the prompt that uses the image. That prompt is still routed normally.
/statusshows how many images are waiting for the next prompt.- Clipboard captures are saved in the ignored
.babysitter/attachments/folder.
Why not the native image paste? Provider hooks cannot change the model for a prompt that was already submitted. So Babysitter uses Codex app-server and the Claude Agent SDK, which do allow a model choice on every turn.
How routing works
For every prompt, Jev returns scores for complexity, risk, and breadth, plus the task type and whether an important decision is missing. Babysitter turns those into one of four tiers:
| Tier | Chosen for |
|---|---|
| Luna | Clear, repeatable, mechanical work |
| Terra | Everyday engineering work |
| Sol | Complex, ambiguous, broad, or high-risk work |
| Astra | The hardest work: high complexity plus high impact or broad scope |
The rules
- Complexity
0 → Luna,1 → Terra,2 → Sol. - High-risk or repository-wide work goes to at least Sol.
- A
researchlabel or low confidence alone does not raise the tier. - Astra needs complexity
3plus high risk or broad scope. Otherwise complexity3stops at Sol. - If Jev is down, the prompt runs on Terra with medium effort instead of blocking.
These are Babysitter's own rules, not limits set by Jev, OpenAI, or Anthropic. Read or change them in src/policy.js.
Model mappings
Codex
| Tier | Default model | Typical role |
|---|---|---|
| Luna | gpt-5.6-luna | Clear, repeatable tasks |
| Terra | gpt-5.6-terra | Everyday work |
| Sol | gpt-5.6-sol | Complex or open-ended work |
| Astra | gpt-6-astra | Hardest end-to-end workflows |
Override with JEV_AUTO_LUNA_MODEL, JEV_AUTO_TERRA_MODEL, JEV_AUTO_SOL_MODEL, or JEV_AUTO_ASTRA_MODEL.
Claude Code
| Tier | Default model | Typical role | Effort |
|---|---|---|---|
| Luna | haiku | Fast, low-cost work and small sub-tasks | Claude default |
| Terra | sonnet | Everyday coding | medium |
| Sol | opus | Complex coding, broad changes, higher-risk work | high |
| Astra | fable | Demanding reasoning and long agentic work | xhigh |
- In routed Claude sessions the terminal shows only Claude names: Haiku, Sonnet, Opus, and Fable.
bbs-clauderuns turns through the official Claude Agent SDK and resumes the same session each turn.- Effort is only sent to models that support it. Haiku uses Claude Code's default.
bbs-claude --printstill uses Claude Code's normal non-interactive mode.
Override with JEV_AUTO_CLAUDE_LUNA_MODEL, JEV_AUTO_CLAUDE_TERRA_MODEL, JEV_AUTO_CLAUDE_SOL_MODEL, or JEV_AUTO_CLAUDE_ASTRA_MODEL. Only use a model your Claude Code account can access.
Cache-aware Claude routing
Claude's prompt cache belongs to one model. A cache made for Sonnet cannot be reused by Haiku, Opus, or Fable. Changing effort can also reset it.
So switching models after every prompt can cost more than it saves. Babysitter keeps classifying separate from switching: Jev still scores every prompt, and a session policy decides if a switch is worth it.
Default policy
- Upgrades happen right away.
- Downgrades wait until the current model has handled at least 3 turns.
- Once the conversation reaches about 12,000 tokens, automatic downgrades stop.
- Lower effort is never applied inside a warm session, because it would reset the cache.
- A higher-effort upgrade can still happen when the tier needs it.
The route card says when a model was kept for the cache or changed for quality. After each answer, Babysitter shows the usage Claude Code reports:
| Field | Meaning |
|---|---|
new | Uncached input tokens for this request |
cache read | Earlier context reused from the cache |
cache write | Context written into a new or updated cache entry |
output | Tokens in the response |
cost | Cost reported by the provider, when Claude Code gives it |
Babysitter shows the provider's own numbers. It does not estimate savings. Tune the policy with JEV_AUTO_CLAUDE_CACHE_LOCK_TOKENS and JEV_AUTO_CLAUDE_MIN_TURNS_PER_MODEL.
What /compact does
In bbs-claude, /compact starts a fresh session instead of making another model load the whole old transcript:
- The current model writes a short handoff: goal, decisions, limits, files, work done, test results, open issues, next steps.
- Babysitter closes the routing context. The original Claude session stays saved.
- Your next prompt is classified as usual.
- The chosen model starts a new session with the handoff plus your prompt.
You can say what to keep:
/compact preserve the database migration decisions and remaining test failuresThis trades a perfect transcript for a much smaller context. Use /native if you want Claude Code's own compaction.
Resume saved sessions
Babysitter can pick up a saved session and keep routing each new prompt.
# Codex: list saved threads
bbs-codex sessions
# Codex: pick a thread interactively, or resume one by ID
bbs-codex resume
bbs-codex resume <thread-id>
# Claude: continue the latest session in this folder
bbs-claude continue # same as -c or --continue
# Claude: resume by ID or name
bbs-claude resume <session-id-or-name> # same as -r or --resume- You can add a first prompt, for example
bbs-claude -r auth-refactor "Finish this PR". bbs-claudeprints its session ID after each answer so you can resume later.- The first prompt after resuming may miss the cache if Jev picks a different model than last time.
bbs-claude -rwith no ID, orbbs-claude sessions, opens Claude Code's own session picker. Pass the ID you pick tobbs-claude -rto go back to a routed session.
Slash commands
Babysitter handles the commands that affect routing and context:
| Command | In bbs-claude | In bbs-codex |
|---|---|---|
/compact | Writes a handoff, then starts a fresh routed session on the next prompt | Runs Codex's own thread compaction |
/paste | Attaches the clipboard image to the next prompt | Same |
/image <path> | Attaches a PNG, JPEG, GIF, or WebP file | Same |
/status | Shows session, route, effort, and context estimate | Shows the thread and routing state |
/permissions [mode] | Shows or changes the permission mode | Not used |
/new, /clear | Starts a fresh routed session | Use /native and the Codex command |
/rc [name] | Resumes with Claude Remote Control; routing pauses meanwhile | Not available |
/native | Opens this session in the full Claude Code terminal | Hands this thread to the full Codex terminal |
/help | Shows Babysitter commands | Shows Babysitter commands |
- For any other provider command, use
/native. The same session is handed over, and routing pauses until you exit. - Unknown slash commands are never sent to the model as text. Babysitter tells you and points you to
/native.
Claude permissions
When Claude needs approval or asks a question, Babysitter pauses the turn, shows the request in the same terminal, takes your answer, and lets Claude continue.
- Routed turns start in Claude Code's
acceptEditsmode. Normal file edits are approved automatically. - Protected commands ask you: allow once, always allow (when Claude offers a safe rule), or deny.
- To deny with a reason, type
nplus feedback, liken use the staging database instead. bypassPermissionsis never offered as a routed mode.
/permissions acceptEdits # default: edit files, guard bigger actions
/permissions plan # read-only planning
/permissions dontAsk # deny anything not already allowed
/permissions auto # classifier-based approvals, if your account supports itTo change the default, set JEV_AUTO_CLAUDE_PERMISSION_MODE to acceptEdits, plan, dontAsk, or auto. Anything else falls back to acceptEdits.
One-shot Codex
Non-interactive Codex commands are routed too:
bbs-codex exec "Review the current changes for security problems"Configuration
Copy .env.example to .env. Only one setting is required:
TYPESAFE_API_KEY=your_typesafe_keyOptional settings
| Setting | What it does |
|---|---|
JEV_MODEL | Jev model to use. Default jev-latest |
JEV_BASE_URL | Jev API base URL |
JEV_AUTO_*_MODEL | Override a Codex tier's model |
JEV_AUTO_CLAUDE_*_MODEL | Override a Claude tier's model |
JEV_AUTO_CLAUDE_CACHE_LOCK_TOKENS | Context size after which Claude downgrades stop. Default 12000 |
JEV_AUTO_CLAUDE_MIN_TURNS_PER_MODEL | Turns before a Claude downgrade. Default 3 |
JEV_AUTO_CLAUDE_PERMISSION_MODE | Routed Claude permission mode. Default acceptEdits |
JEV_AUTO_REAL_CODEX | Full path to Codex, if it is not found automatically |
JEV_AUTO_REAL_CLAUDE | Full path to Claude Code, if it is not found automatically |
JEV_AUTO_UPDATE_CHECK | Set to 0 to turn off update notices |
JEV_AUTO_UPDATE_INTERVAL_HOURS | Hours between update checks. Default 24 |
NO_COLOR=1 | Turn off colored terminal output |
The launcher reads the .env in your current folder first, then Babysitter's own .env.
Claude Code sign-in
Babysitter uses your own installed and signed-in Claude Code. It does not proxy or share credentials. Install and sign in with Anthropic's guide:
curl -fsSL https://claude.ai/install.sh | bash
claude auth loginBuilding a product for others on top of this? Use an Anthropic API key or a supported cloud provider. Subscription sign-in is meant for the unmodified Claude Code app.
Updates
When a routed session starts, Babysitter checks GitHub at most once a day. If your copy is behind main, you see:
↑ Babysitter update available · 3 new commits · run bbs-updateUpdate when you are ready:
bbs-update- It runs
git pull --ff-only, refreshes npm packages, and asks you to restart the session. - It refuses to run if your copy has local changes, so it never overwrites your work.
- If the check fails, nothing happens. It never blocks startup.
- There are no silent background updates. Running new code without review is a supply-chain risk.
Limitations
- It only routes sessions started with
bbs-codexorbbs-claude. It cannot reach into a session that is already running. - Every prompt costs one small Jev call. Any saving depends on your work, the models you can use, and whether routing avoids retries.
- Models, effort controls, pricing, and sign-in are set by your Codex and Claude accounts, not by Babysitter.
- Claude Code support needs the official CLI installed and signed in on your machine.
Security
- Never commit
.envor share API keys. - Every person who installs it should use their own TypeSafe key and provider sign-in.
- If a key shows up in a commit, screenshot, issue, or chat, revoke it and make a new one right away.
Before publishing a fork, check:
git check-ignore .env
git statusDevelopment
npm run check
npm test- Tests use Node's built-in test runner.
- Interactive Claude turns use Anthropic's official Claude Agent SDK.
- Issues and pull requests are welcome. If you change routing, add a regression test and explain the cost and quality trade-off.