chompyy 0.4.7 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +40 -6
- package/dist/advice.js +2 -1
- package/dist/agentlimits.js +77 -0
- package/dist/agentusage.js +96 -0
- package/dist/appstate.js +72 -5
- package/dist/away.js +44 -5
- package/dist/blueprint.js +3 -7
- package/dist/board.js +4 -0
- package/dist/cli.js +328 -15
- package/dist/codexquota.js +106 -0
- package/dist/codexusage.js +10 -0
- package/dist/config.js +2 -0
- package/dist/context.js +30 -0
- package/dist/costs.js +1 -0
- package/dist/daytime.js +68 -0
- package/dist/demon.js +20 -0
- package/dist/didwork.js +46 -0
- package/dist/label.js +33 -0
- package/dist/learning.js +35 -0
- package/dist/menu.js +17 -0
- package/dist/nightcap.js +60 -0
- package/dist/nudge.js +47 -18
- package/dist/pacing.js +16 -1
- package/dist/questions.js +71 -0
- package/dist/recap.js +74 -0
- package/dist/receipt.js +48 -0
- package/dist/recipe.js +79 -0
- package/dist/send.js +46 -20
- package/dist/stamps.js +14 -0
- package/dist/taste.js +67 -7
- package/dist/triggers.js +5 -0
- package/dist/unkeep.js +220 -0
- package/dist/usage.js +21 -1
- package/dist/vendor/codeburn/antigravity.js +309 -0
- package/dist/vendor/codeburn/codex.js +429 -0
- package/dist/vendor/codeburn/copilot.js +292 -0
- package/dist/vendor/codeburn/gemini.js +195 -0
- package/dist/vendor/codeburn/grokbot.js +182 -0
- package/dist/vendor/codeburn/kimi.js +178 -0
- package/dist/vendor/codeburn/shims/chalk.js +14 -0
- package/dist/vendor/codeburn/shims/strip-ansi.js +6 -0
- package/dist/vendor/codeburn/src/act/backup.js +83 -0
- package/dist/vendor/codeburn/src/act/model-defaults.js +151 -0
- package/dist/vendor/codeburn/src/act/types.js +37 -0
- package/dist/vendor/codeburn/src/bash-utils.js +204 -0
- package/dist/vendor/codeburn/src/behavioral-weight.js +47 -0
- package/dist/vendor/codeburn/src/cache-dir.js +26 -0
- package/dist/vendor/codeburn/src/cache-refresh-lock.js +543 -0
- package/dist/vendor/codeburn/src/cache-sweep.js +67 -0
- package/dist/vendor/codeburn/src/classifier.js +209 -0
- package/dist/vendor/codeburn/src/claude-identity.js +223 -0
- package/dist/vendor/codeburn/src/codex-cache.js +377 -0
- package/dist/vendor/codeburn/src/codex-fork-replay.js +232 -0
- package/dist/vendor/codeburn/src/codex-jsonl-fields.js +99 -0
- package/dist/vendor/codeburn/src/codex-session-index.js +113 -0
- package/dist/vendor/codeburn/src/codex-throughput.js +544 -0
- package/dist/vendor/codeburn/src/compare-stats.js +405 -0
- package/dist/vendor/codeburn/src/config.js +145 -0
- package/dist/vendor/codeburn/src/content-utils.js +56 -0
- package/dist/vendor/codeburn/src/context-tree-codex.js +329 -0
- package/dist/vendor/codeburn/src/context-tree.js +664 -0
- package/dist/vendor/codeburn/src/copilot-aiu.js +16 -0
- package/dist/vendor/codeburn/src/currency.js +189 -0
- package/dist/vendor/codeburn/src/cursor-cache.js +238 -0
- package/dist/vendor/codeburn/src/cursor-import.js +402 -0
- package/dist/vendor/codeburn/src/cursor-sync.js +256 -0
- package/dist/vendor/codeburn/src/daily-cache.js +2036 -0
- package/dist/vendor/codeburn/src/data/litellm-snapshot.json +1 -0
- package/dist/vendor/codeburn/src/data/pricing-fallback.json +1 -0
- package/dist/vendor/codeburn/src/day-aggregator.js +327 -0
- package/dist/vendor/codeburn/src/editor-data-dir.js +11 -0
- package/dist/vendor/codeburn/src/fetch-utils.js +18 -0
- package/dist/vendor/codeburn/src/format.js +118 -0
- package/dist/vendor/codeburn/src/fs-utils.js +270 -0
- package/dist/vendor/codeburn/src/git-origin.js +334 -0
- package/dist/vendor/codeburn/src/granular-history.js +328 -0
- package/dist/vendor/codeburn/src/hermes-session-ledger.js +512 -0
- package/dist/vendor/codeburn/src/launcher-homes.js +142 -0
- package/dist/vendor/codeburn/src/live-sessions.js +358 -0
- package/dist/vendor/codeburn/src/math-utils.js +8 -0
- package/dist/vendor/codeburn/src/menubar-json.js +294 -0
- package/dist/vendor/codeburn/src/models.js +1879 -0
- package/dist/vendor/codeburn/src/optimize-one-hour-cache.js +92 -0
- package/dist/vendor/codeburn/src/optimize.js +4110 -0
- package/dist/vendor/codeburn/src/parse-workers.js +219 -0
- package/dist/vendor/codeburn/src/parser.js +6953 -0
- package/dist/vendor/codeburn/src/path-privacy.js +26 -0
- package/dist/vendor/codeburn/src/plans.js +135 -0
- package/dist/vendor/codeburn/src/pr-signals.js +132 -0
- package/dist/vendor/codeburn/src/project-filter-warnings.js +33 -0
- package/dist/vendor/codeburn/src/provider-issues.js +30 -0
- package/dist/vendor/codeburn/src/providers/amp.js +286 -0
- package/dist/vendor/codeburn/src/providers/antigravity.js +1731 -0
- package/dist/vendor/codeburn/src/providers/claude.js +551 -0
- package/dist/vendor/codeburn/src/providers/cline-cli.js +401 -0
- package/dist/vendor/codeburn/src/providers/cline.js +63 -0
- package/dist/vendor/codeburn/src/providers/codebuff.js +336 -0
- package/dist/vendor/codeburn/src/providers/codewhale.js +442 -0
- package/dist/vendor/codeburn/src/providers/codex.js +1720 -0
- package/dist/vendor/codeburn/src/providers/command-code.js +196 -0
- package/dist/vendor/codeburn/src/providers/copilot.js +3278 -0
- package/dist/vendor/codeburn/src/providers/crush.js +226 -0
- package/dist/vendor/codeburn/src/providers/cursor-agent.js +837 -0
- package/dist/vendor/codeburn/src/providers/cursor.js +1163 -0
- package/dist/vendor/codeburn/src/providers/devin.js +569 -0
- package/dist/vendor/codeburn/src/providers/droid.js +324 -0
- package/dist/vendor/codeburn/src/providers/dsh.js +690 -0
- package/dist/vendor/codeburn/src/providers/forge.js +245 -0
- package/dist/vendor/codeburn/src/providers/gemini.js +230 -0
- package/dist/vendor/codeburn/src/providers/goose.js +252 -0
- package/dist/vendor/codeburn/src/providers/grok.js +581 -0
- package/dist/vendor/codeburn/src/providers/grokbot.js +290 -0
- package/dist/vendor/codeburn/src/providers/hermes.js +771 -0
- package/dist/vendor/codeburn/src/providers/ibm-bob.js +53 -0
- package/dist/vendor/codeburn/src/providers/index.js +360 -0
- package/dist/vendor/codeburn/src/providers/kilo-code.js +50 -0
- package/dist/vendor/codeburn/src/providers/kimi.js +363 -0
- package/dist/vendor/codeburn/src/providers/kimicode.js +402 -0
- package/dist/vendor/codeburn/src/providers/kiro.js +1174 -0
- package/dist/vendor/codeburn/src/providers/lingtai-tui.js +372 -0
- package/dist/vendor/codeburn/src/providers/mistral-vibe-unified.js +236 -0
- package/dist/vendor/codeburn/src/providers/mistral-vibe.js +405 -0
- package/dist/vendor/codeburn/src/providers/mux.js +242 -0
- package/dist/vendor/codeburn/src/providers/open-design.js +217 -0
- package/dist/vendor/codeburn/src/providers/openclaude.js +309 -0
- package/dist/vendor/codeburn/src/providers/openclaw.js +442 -0
- package/dist/vendor/codeburn/src/providers/opencode-file-parser.js +131 -0
- package/dist/vendor/codeburn/src/providers/opencode.js +91 -0
- package/dist/vendor/codeburn/src/providers/pi.js +429 -0
- package/dist/vendor/codeburn/src/providers/quickdesk.js +491 -0
- package/dist/vendor/codeburn/src/providers/qwen.js +193 -0
- package/dist/vendor/codeburn/src/providers/session-message.js +118 -0
- package/dist/vendor/codeburn/src/providers/sqlite-session-parser.js +457 -0
- package/dist/vendor/codeburn/src/providers/types.js +5 -0
- package/dist/vendor/codeburn/src/providers/vercel-gateway.js +135 -0
- package/dist/vendor/codeburn/src/providers/vscode-cline-parser.js +212 -0
- package/dist/vendor/codeburn/src/providers/warp.js +575 -0
- package/dist/vendor/codeburn/src/providers/zcode.js +249 -0
- package/dist/vendor/codeburn/src/providers/zed.js +187 -0
- package/dist/vendor/codeburn/src/providers/zerostack.js +139 -0
- package/dist/vendor/codeburn/src/quota/antigravity.js +310 -0
- package/dist/vendor/codeburn/src/quota/claude.js +244 -0
- package/dist/vendor/codeburn/src/quota/cursor.js +301 -0
- package/dist/vendor/codeburn/src/quota/security.js +299 -0
- package/dist/vendor/codeburn/src/quota/types.js +1 -0
- package/dist/vendor/codeburn/src/scan-facts.js +99 -0
- package/dist/vendor/codeburn/src/session-cache.js +3040 -0
- package/dist/vendor/codeburn/src/session-count-label.js +14 -0
- package/dist/vendor/codeburn/src/session-output.js +139 -0
- package/dist/vendor/codeburn/src/session-population.js +30 -0
- package/dist/vendor/codeburn/src/sessions-report.js +1342 -0
- package/dist/vendor/codeburn/src/sqlite.js +528 -0
- package/dist/vendor/codeburn/src/sync/otlp.js +420 -0
- package/dist/vendor/codeburn/src/telemetry-snapshot.js +244 -0
- package/dist/vendor/codeburn/src/token-estimate.js +5 -0
- package/dist/vendor/codeburn/src/types.js +16 -0
- package/dist/vendor/codeburn/src/work-units.js +126 -0
- package/dist/vendor/codeburn/src/workflow-insights.js +228 -0
- package/dist/vendor/codeburn/src/wsl.js +198 -0
- package/dist/vendor/codeburn/src/yield.js +666 -0
- package/package.json +11 -3
package/README.md
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
# chompyy (CLI)
|
|
2
2
|
|
|
3
|
-
Uses the capacity in Claude Code's 5-hour window that would otherwise reset unused. You park ideas as cards, each card gets a short **blueprint** (the scope agreed before it runs), approved cards run headless while you're away, and a report shows what ran so you can rate it.
|
|
3
|
+
Uses the capacity in Claude Code's 5-hour window that would otherwise reset unused. You park ideas as cards, each card gets a short **blueprint** (the scope agreed before it runs), approved cards run headless while you're away, and a report shows what ran so you can rate it, keep it and send it to GitHub.
|
|
4
4
|
|
|
5
|
-
This is the
|
|
5
|
+
This is the engine behind the [Mac app](../mac/README.md): everything the app does is a `chompyy` command, so it all works from Terminal too. Node 20+, no runtime dependencies. Design: [the spec](../research/spec-token-utilization.md).
|
|
6
6
|
|
|
7
7
|
## Install
|
|
8
8
|
|
|
@@ -116,28 +116,62 @@ Each card in a git repo runs in its own worktree at `~/.chompyy/worktrees/<id>`
|
|
|
116
116
|
| `chompyy blueprint <id> [--model m]` | Draft (or redraft) the blueprint with a cheap model |
|
|
117
117
|
| `chompyy picture <id> [--model m]` | Draw (or redraw) the card's picture: a diagram of what it will do, made with the diagram-design skill. Happens on its own after each blueprint while a window is active (`"pictures": false` in config.json turns it off) |
|
|
118
118
|
| `chompyy edit-idea <id>` | Replace a *later* card's idea (and its title) with text from stdin, e.g. `echo "new idea" \| chompyy edit-idea 3`. The blueprint stays; redraft it with `blueprint <id>` |
|
|
119
|
-
| `chompyy
|
|
119
|
+
| `chompyy edit-blueprint <id>` | Replace a card's blueprint with text from stdin |
|
|
120
|
+
| `chompyy approve <id>` / `chompyy drop <id>` | Queue a card for away runs / remove it (kept in `archive.jsonl`) |
|
|
121
|
+
| `chompyy answer <id> ["answers"]` | Answer a card's questions (as words, or on stdin); it goes back to *approved* and the next away run continues it |
|
|
122
|
+
| `chompyy suggest [repo] [--force]` | A few tasks for a repo, from its goals and its code, added as suggested cards (one model call, only inside an active window) |
|
|
120
123
|
| `chompyy away <1h\|30m\|1h30m> [--dry-run] [--force]` | Run approved cards until the time is up or the gate closes |
|
|
121
124
|
| `chompyy report [--all]` | Cards that ran since the last report: one action each, cards needing you first. No paths or raw agent text; ask for those with `show` |
|
|
122
125
|
| `chompyy diff <id>` | The change the card made on its branch |
|
|
126
|
+
| `chompyy recipe <id>` | A kept card as a recipe: the files it changed, the steps it took, when it landed (`--json` for the app) |
|
|
123
127
|
| `chompyy keep <id>` | Merge the card's branch into your current branch and remove its worktree. Refuses when you have unsaved changes in a file the card also changed, or anything staged; other unsaved work is left alone |
|
|
124
|
-
| `chompyy undo <id
|
|
128
|
+
| `chompyy undo <id> [--plan] [--json]` | Throw the run away: remove its worktree and branch (or draft folder). Your own branches are never touched. On a kept card it takes the card back: off your branch when it's only on this Mac (closing its PR if one is open), or with a revert PR on GitHub once its PR merged. `--plan` says which and changes nothing |
|
|
129
|
+
| `chompyy redo <id>` | Throw a ran card's result away and put it back in *approved*; it runs again from your latest code |
|
|
130
|
+
| `chompyy continue <id> ["what is still missing"]` | Put a ran card back in *approved* as its next cycle; the next run gets what the last one did, plus your note |
|
|
131
|
+
| `chompyy refresh [<id>]` | Bring a card that clashes with your newer main up to date and check it again (no id: every clashing card). Waits for quota when there is none |
|
|
132
|
+
| `chompyy send [--json]` | Open one pull request on GitHub per kept card your main has and GitHub's doesn't, from `chompyy/card-<id>` with just that card's commits (needs `gh`). Main itself is never pushed. Run it again after merging: once every card is on GitHub, your main moves to match GitHub's (only when that loses nothing; unsaved work is kept) |
|
|
125
133
|
| `chompyy rate <id> <1-5> ["why"]` | Rate a result against its blueprint; moves it to *done* and logs a signal |
|
|
134
|
+
| `chompyy signals [--json]` | Every signal so far (ratings, edits, cold start picks), oldest first |
|
|
126
135
|
| `chompyy taste` | Show `taste.md` |
|
|
127
136
|
| `chompyy taste list` / `why <id>` | Every learned preference and its status / the cards, edits and quotes behind one |
|
|
128
137
|
| `chompyy taste yes\|not-now\|never <id>` | Answer the report's question. Only *yes* writes it to `taste.md`; *never* stops Chompyy proposing it again |
|
|
129
138
|
| `chompyy taste retire <id>` | Stop using a preference; it stays in `taste list` with the reason |
|
|
139
|
+
| `chompyy taste daytime [on\|off]` | Your rules in every Claude Code session too: one import line in `~/.claude/CLAUDE.md` loads `~/.chompyy/taste-for-claude.md`, which Chompyy keeps up to date. Off takes the line out |
|
|
140
|
+
| `chompyy dream [--dry-run] [--force] [--since 7d]` | The nightly read: learn taste from your recent Claude Code sessions in ticked folders now. Runs on its own at bedtime when on |
|
|
141
|
+
| `chompyy dream workspaces` / `tick <folder>` / `untick <folder>` / `on\|off` | Which folders the nightly read may learn from; turn it on or off |
|
|
130
142
|
| `chompyy distill [--force]` | Read new signals and update preferences now (also runs after every away run) |
|
|
131
|
-
| `chompyy trends` | Last 7 days vs the 7 before: cost per card, keep rate, rating, blueprint edits |
|
|
143
|
+
| `chompyy trends` | Last 7 days vs the 7 before: cost per card, keep rate, rating, blueprint edits; then what Chompyy learned: rules this week, waiting, corrections per conversation |
|
|
132
144
|
| `chompyy premise [--json]` | How often a 5-hour window reset with 20%+ left in a week that still had 10%+ spare: the capacity away runs can use. From your quota readings; every ended window is kept in `windows.jsonl` (numbers only), so it grows past the 8 days of `quota-history.json`. `--json` to share it |
|
|
133
145
|
| `chompyy detect [--days 30] [--all] [--json]` | The detective: what wastes tokens in your setup and habits, from your own files. One screen: the findings ranked by tokens and the fix to start with; `--all` adds each finding's count, measured or estimated, what it doesn't prove, and every fix. A mid-session cache rebuild names its cause (e.g. Tool Search loading an MCP server's tools). Works cold with `npx chompyy detect`, nothing else installed. This version checks startup tax (long CLAUDE.md, unused skills and MCP servers, cut-off MEMORY.md) and cache (cold returns, mid-session rebuilds). Reads only; changes nothing |
|
|
134
146
|
| `chompyy advise [--json]` | The detective, step 3: turns detect's findings into suggested cards on the board (the app's "Find savings"). Each card's plan shows what Chompyy saw, what it doesn't prove, the exact change and how it will check it worked. Approve a settings card (e.g. turn off a plugin you never use) and Chompyy applies it once no Claude Code session has been active for 10 minutes, backed up first; `chompyy undo <id>` puts it back if nothing changed it since. Habit cards are tracked from the day you approve; some things only you can do (claude.ai-synced skills). Dropped advice never comes back. Advice never runs on an away run |
|
|
135
147
|
| `chompyy advise apply` | Apply approved settings advice now if no session has been active for 10 minutes (the app and the 5-minute tick do this on their own) |
|
|
148
|
+
| `chompyy worked [--all] [--json] [--share]` | Did the advice work: each applied card against the check it set up, plus the nudge's measured result, and one "Saved so far" total (also in the menu panel) that adds only what was counted. `--share` prints a summary with no project, skill or file names |
|
|
136
149
|
| `chompyy nudge on\|off` | Live suggestions while you work. Adds a UserPromptSubmit hook to `~/.claude/settings.json` (backed up first; your other hooks stay). When you come back to a conversation of 40k+ tokens after more than an hour, its cache has expired: the hook stops that first message once and says what sending it rebuilds, what a fresh start costs, and the cheaper ways (/clear with a note, or /compact). Send it again and it goes through. A conversation compacted since its last reply (your /compact, or Claude Code's own while you were away) sends a summary, so it isn't stopped. Needs a global install (`npm install -g chompyy`); away runs turn hooks off, so it never touches them |
|
|
137
150
|
| `chompyy nudge [--json]` | On or off, what the stops and warnings led to (compacted, left, sent anyway), the tokens not written again, and the measured trend: cold returns this week against last week. The menu panel shows the same line |
|
|
138
151
|
| `chompyy nudge due [--json]` | Conversations 45-60 minutes into a pause, about to go cold, each reported once (only while nudge is on). The menu bar app asks every minute and sends a notification, while /compact is still cheap. Skips conversations already compacted |
|
|
139
152
|
| `chompyy triggers on\|off` | Install or remove the macOS LaunchAgent that runs `chompyy tick` every 5 minutes |
|
|
140
|
-
| `chompyy
|
|
153
|
+
| `chompyy limits [<agent> on\|off] [--json]` | Limits for Gemini CLI, GitHub Copilot, Antigravity, Kimi Code and Grok Bot through codeburn's readers. Each is off until you allow it, since it uses that agent's own login (read-only, never rewritten) |
|
|
154
|
+
| `chompyy recap [--month 2026-11] [--json]` | Your month with Chompyy on one card: tokens, API value and cookies, busiest day, conversations, cards baked and kept, biggest bake. This month once it's a week old, else last month. No names, safe to share |
|
|
155
|
+
| `chompyy menu [--json]` | Every coding agent you used in the last 30 days as a café chalkboard: Claude Code and the others, tokens and API value, most first. Agent and model names only, safe to share |
|
|
156
|
+
| `chompyy label [--json]` | Your week of Claude Code as a Nutrition Facts label: cached reads (fibre), cache writes (carbs), tokens resent after a break (added sugar), input and output (protein). Amounts only, safe to share |
|
|
157
|
+
| `chompyy stamps [--json]` | Your loyalty stamp card: one stamp per card you kept, ten to a card, with the dates. No titles, safe to share |
|
|
158
|
+
| `chompyy agents [--json] [--refresh]` | Every other coding agent codeburn reads (Cursor, Copilot, Gemini CLI, OpenCode, … about 40): tokens and API value today, this week and over 30 and 90 days (agents used in the last 90 days), at most one scan per 10 minutes |
|
|
159
|
+
| `chompyy codex [on\|off] [--json]` | Codex beside Claude: its 5-hour and weekly limits (reads Codex's saved login to ask OpenAI; never renews or changes it) and its tokens and API value (codeburn's Codex parser) |
|
|
160
|
+
| `chompyy nightcap [on [23:30]\|skip\|unskip]` | The evening offer: run approved cards at bedtime tonight (`on` sets bedtime and turns triggers on), or skip tonight |
|
|
161
|
+
| `chompyy demon [on\|off]` | Demon mode: in the last 90 minutes of a window that would reset 20%+ unused, run approved cards to eat it (`on` = every window, via the last-hour trigger) |
|
|
162
|
+
| `chompyy receipt [--json]` | Your week as a bake-sale receipt: cards baked and their API value, kept, burnt (undone), tokens, resent less than last week. No names, safe to share |
|
|
163
|
+
| `chompyy bedtime <23:30\|off>` / `chompyy last-hour <on\|off>` / `chompyy missed-reset <on\|off>` | Turn the bedtime, last-hour-before-reset and missed-reset (first tick after an unused reset, default off) triggers on or off |
|
|
164
|
+
| `chompyy quota [--refresh] [--allow-keychain\|--no-keychain]` | Read the live quota now and show `status`. The keychain flags allow or stop reading your Claude sign-in from the macOS keychain |
|
|
165
|
+
| `chompyy usage [--period today\|7d\|30d\|month] [--days 7] [--json]` | Tokens and cost by day, project and kind of work, pull request costs, and how your plan compares with API prices |
|
|
166
|
+
| `chompyy trace <conversation id> [--json]` | Where one conversation's tokens went (ids: `chompyy usage --json`) |
|
|
167
|
+
| `chompyy tokens [--json]` | Exact tokens and API-price cost of each away run (last 20) |
|
|
168
|
+
| `chompyy plan-price <dollars\|auto>` | Your plan's monthly price, for the plan-vs-API comparison in `usage` |
|
|
169
|
+
| `chompyy history [--digest] [--json]` | What cold start would read: sessions, projects, dates. Local; sends nothing |
|
|
170
|
+
| `chompyy coldstart [show\|accept\|forget] [--force]` | One model call that proposes taste lines and suggested cards from your history; `accept --taste t1 --cards c1` keeps the ones you pick |
|
|
171
|
+
| `chompyy keep-history <days>` | How long Claude Code keeps transcripts (default 30 days) |
|
|
172
|
+
| `chompyy projects [--json]` | Recent project folders, for picking where a card runs |
|
|
173
|
+
| `chompyy app` | macOS: download and open the menu bar app |
|
|
174
|
+
| `chompyy version` / `chompyy help` | The CLI's version / the command list |
|
|
141
175
|
|
|
142
176
|
## Taste
|
|
143
177
|
|
package/dist/advice.js
CHANGED
|
@@ -214,10 +214,11 @@ export function approveAdvice(c, now) {
|
|
|
214
214
|
a.note = 'Applies once no Claude Code session has run for 10 minutes.';
|
|
215
215
|
return `✅ #${c.id} approved. Applies once no Claude Code session has run for 10 minutes.`;
|
|
216
216
|
}
|
|
217
|
+
// Nothing for Chompyy to apply or run: the card closes at once, so it leaves the board.
|
|
217
218
|
c.column = 'done';
|
|
218
219
|
a.since = at;
|
|
219
220
|
a.state = a.lane === 'habit' ? 'trying' : 'done';
|
|
220
|
-
return a.lane === 'habit' ? `✅ #${c.id}: trying it from today. ${a.check}` : `✅ #${c.id}
|
|
221
|
+
return a.lane === 'habit' ? `✅ #${c.id} closed: trying it from today. ${a.check}` : `✅ #${c.id} closed. ${a.check}`;
|
|
221
222
|
}
|
|
222
223
|
/** When a Claude Code session last wrote its transcript (ms), so settings never change under an open conversation. */
|
|
223
224
|
export function lastSessionActivity(root = projectsDir()) {
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
// Limits for the other agents codeburn can read them for, beside Claude and Codex: Gemini CLI, GitHub Copilot,
|
|
2
|
+
// Antigravity, Kimi Code and Grok Bot, through codeburn's own readers (src/vendor/codeburn/<agent>.ts).
|
|
3
|
+
//
|
|
4
|
+
// Each one is off until you allow it (config agentLimits), because it uses that agent's saved login: Gemini's
|
|
5
|
+
// ~/.gemini/oauth_creds.json, Copilot's ~/.config/github-copilot, Kimi's ~/.kimi-code credentials, the session of
|
|
6
|
+
// the Cursor app Grok Bot uses, or Antigravity's own app running on this Mac. All read-only: none of these readers
|
|
7
|
+
// writes a login back (checked 2026-12-05). Each agent is asked at most every 5 minutes.
|
|
8
|
+
import { existsSync } from 'node:fs';
|
|
9
|
+
import { homedir } from 'node:os';
|
|
10
|
+
import { join } from 'node:path';
|
|
11
|
+
import { fetchAntigravityQuota } from './vendor/codeburn/antigravity.js';
|
|
12
|
+
import { copilotConfigDirs, fetchCopilotQuota } from './vendor/codeburn/copilot.js';
|
|
13
|
+
import { fetchGeminiQuota } from './vendor/codeburn/gemini.js';
|
|
14
|
+
import { fetchGrokbotQuota, grokbotInstalled } from './vendor/codeburn/grokbot.js';
|
|
15
|
+
import { fetchKimiQuota } from './vendor/codeburn/kimi.js';
|
|
16
|
+
import { homePath, readJson, writeJson } from './home.js';
|
|
17
|
+
export const LIMITS_MIN_INTERVAL_MS = 5 * 60_000;
|
|
18
|
+
const home = homedir();
|
|
19
|
+
export const READERS = [
|
|
20
|
+
{ name: 'gemini', displayName: 'Gemini CLI', login: "the Gemini CLI's saved Google login", hint: 'Run the Gemini CLI once to sign in, then refresh.', installed: () => existsSync(join(home, '.gemini', 'oauth_creds.json')), fetch: () => fetchGeminiQuota() },
|
|
21
|
+
{ name: 'copilot', displayName: 'GitHub Copilot', login: "Copilot's saved GitHub login", hint: 'Sign in to GitHub Copilot in your editor once, then refresh.', installed: () => copilotConfigDirs().some((d) => existsSync(join(d, 'apps.json')) || existsSync(join(d, 'hosts.json'))), fetch: () => fetchCopilotQuota() },
|
|
22
|
+
{ name: 'antigravity', displayName: 'Antigravity', login: 'the Antigravity app running on this Mac', hint: 'Open the Antigravity app, then refresh.', installed: () => existsSync('/Applications/Antigravity.app') || existsSync(join(home, '.gemini', 'antigravity')), fetch: async () => ({ quota: await fetchAntigravityQuota() }) },
|
|
23
|
+
{ name: 'kimi', displayName: 'Kimi Code', login: "Kimi Code's saved login", hint: 'Sign in to Kimi Code once, then refresh.', installed: () => existsSync(join(process.env.KIMI_CODE_HOME ?? join(home, '.kimi-code'), 'credentials', 'kimi-code.json')), fetch: () => fetchKimiQuota() },
|
|
24
|
+
{ name: 'grokbot', displayName: 'Grok Bot', login: 'the Cursor app session Grok Bot uses', hint: 'Sign in to the Cursor app with the account Grok Bot uses, then refresh.', installed: () => grokbotInstalled(), fetch: () => fetchGrokbotQuota() },
|
|
25
|
+
];
|
|
26
|
+
const filePath = () => homePath('agent-limits.json');
|
|
27
|
+
export const loadLimits = () => readJson(filePath(), {});
|
|
28
|
+
function windowOf(w) {
|
|
29
|
+
return { label: w.label, usedPct: Math.round(w.percent * 1000) / 10, resetsAt: w.resetsAt ? Math.floor(Date.parse(w.resetsAt) / 1000) : null };
|
|
30
|
+
}
|
|
31
|
+
export function limitFrom(q, now, hint = '') {
|
|
32
|
+
return {
|
|
33
|
+
lastTryAt: now.toISOString(),
|
|
34
|
+
connection: q.connection,
|
|
35
|
+
plan: q.planLabel,
|
|
36
|
+
primary: q.primary ? windowOf(q.primary) : null,
|
|
37
|
+
windows: q.details.map(windowOf),
|
|
38
|
+
note: q.connection === 'connected' ? null : q.footerLines.join(' ') || hint || null,
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
/** Read the allowed agents' limits (each at most every 5 minutes unless forced) and save them. */
|
|
42
|
+
export async function refreshLimits(allowed, opts = {}) {
|
|
43
|
+
const now = opts.now ?? new Date();
|
|
44
|
+
const saved = loadLimits();
|
|
45
|
+
for (const r of opts.readers ?? READERS) {
|
|
46
|
+
if (!allowed[r.name] || !r.installed())
|
|
47
|
+
continue;
|
|
48
|
+
const last = saved[r.name];
|
|
49
|
+
if (last?.retryAfterAt && Date.parse(last.retryAfterAt) > now.getTime())
|
|
50
|
+
continue;
|
|
51
|
+
if (!opts.force && last && now.getTime() - Date.parse(last.lastTryAt) < LIMITS_MIN_INTERVAL_MS)
|
|
52
|
+
continue;
|
|
53
|
+
try {
|
|
54
|
+
const res = await r.fetch();
|
|
55
|
+
const next = limitFrom(res.quota, now, r.hint);
|
|
56
|
+
if (res.retryAfterSeconds)
|
|
57
|
+
next.retryAfterAt = new Date(now.getTime() + res.retryAfterSeconds * 1000).toISOString();
|
|
58
|
+
saved[r.name] = next;
|
|
59
|
+
}
|
|
60
|
+
catch {
|
|
61
|
+
saved[r.name] = { lastTryAt: now.toISOString(), connection: 'transientFailure', plan: null, primary: null, windows: [], note: `Couldn't read ${r.displayName}'s limits right now.` };
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
writeJson(filePath(), saved);
|
|
65
|
+
return saved;
|
|
66
|
+
}
|
|
67
|
+
/** For the app: every agent on this Mac with a limits reader, whether you allowed it, and its last reading. */
|
|
68
|
+
export function limitsState(allowed, readers = READERS) {
|
|
69
|
+
const saved = loadLimits();
|
|
70
|
+
const out = {};
|
|
71
|
+
for (const r of readers) {
|
|
72
|
+
if (!r.installed())
|
|
73
|
+
continue;
|
|
74
|
+
out[r.name] = { displayName: r.displayName, login: r.login, allowed: r.name in allowed ? allowed[r.name] : null, limit: allowed[r.name] ? saved[r.name] ?? null : null };
|
|
75
|
+
}
|
|
76
|
+
return out;
|
|
77
|
+
}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
// Every coding agent codeburn reads (Codex, Cursor, Copilot, Gemini CLI, OpenCode, … ~40 of them), through its own
|
|
2
|
+
// readers in src/vendor/codeburn/src/providers/: where each keeps its sessions, their formats and the quirks codeburn
|
|
3
|
+
// works around. Claude is left out: Chompyy reads Claude Code itself (usage.ts).
|
|
4
|
+
//
|
|
5
|
+
// Scanning every agent takes a few seconds, so it runs at most every 10 minutes (`chompyy agents`, which the app
|
|
6
|
+
// calls) and the result is saved; `chompyy state` only reads the saved file.
|
|
7
|
+
import { homePath, readJson, writeJson } from './home.js';
|
|
8
|
+
import { loadPricing } from './vendor/codeburn/src/models.js';
|
|
9
|
+
import { getAllProviders, providerDisplayName, safeDiscoverSessions } from './vendor/codeburn/src/providers/index.js';
|
|
10
|
+
export const AGENTS_MIN_INTERVAL_MS = 10 * 60_000;
|
|
11
|
+
const filePath = () => homePath('agents-usage.json');
|
|
12
|
+
export const loadAgents = () => readJson(filePath(), null);
|
|
13
|
+
/** Every token a call moved: fresh input, cache writes, cache reads and output (reasoning is part of output). */
|
|
14
|
+
export const callTokens = (c) => c.inputTokens + c.outputTokens + c.cacheCreationInputTokens + c.cacheReadInputTokens;
|
|
15
|
+
/** Quiet settings for codeburn inside Chompyy: bundled prices only (no download), its cache in ~/.chompyy. */
|
|
16
|
+
export async function prepareCodeburn() {
|
|
17
|
+
process.env.CODEBURN_PRICING_SNAPSHOT_ONLY ??= '1';
|
|
18
|
+
process.env.CODEBURN_CACHE_DIR ??= homePath('codeburn-cache');
|
|
19
|
+
await loadPricing();
|
|
20
|
+
}
|
|
21
|
+
/** One agent's tokens and API value today (local day) and over the last 7, 30 and 90 days. */
|
|
22
|
+
export async function usageFor(provider, now, sources) {
|
|
23
|
+
const end = now.getTime();
|
|
24
|
+
const start = end - 90 * 24 * 3600_000;
|
|
25
|
+
const monthStart = end - 30 * 24 * 3600_000;
|
|
26
|
+
const weekStart = end - 7 * 24 * 3600_000;
|
|
27
|
+
const dayStart = new Date(now.getFullYear(), now.getMonth(), now.getDate()).getTime();
|
|
28
|
+
const today = { tokens: 0, costUsd: 0 };
|
|
29
|
+
const week = { tokens: 0, costUsd: 0 };
|
|
30
|
+
const month = { tokens: 0, costUsd: 0 };
|
|
31
|
+
const quarter = { tokens: 0, costUsd: 0 };
|
|
32
|
+
const byModel = new Map();
|
|
33
|
+
const seen = new Set();
|
|
34
|
+
for (const source of sources ?? (await provider.discoverSessions())) {
|
|
35
|
+
for await (const call of provider.createSessionParser(source, seen, { start: new Date(start), end: now }).parse()) {
|
|
36
|
+
const at = Date.parse(call.timestamp);
|
|
37
|
+
if (!Number.isFinite(at) || at < start || at > end)
|
|
38
|
+
continue;
|
|
39
|
+
const n = callTokens(call);
|
|
40
|
+
quarter.tokens += n;
|
|
41
|
+
quarter.costUsd += call.costUSD;
|
|
42
|
+
if (at >= monthStart) {
|
|
43
|
+
month.tokens += n;
|
|
44
|
+
month.costUsd += call.costUSD;
|
|
45
|
+
}
|
|
46
|
+
if (at >= weekStart) {
|
|
47
|
+
week.tokens += n;
|
|
48
|
+
week.costUsd += call.costUSD;
|
|
49
|
+
}
|
|
50
|
+
if (at >= dayStart) {
|
|
51
|
+
today.tokens += n;
|
|
52
|
+
today.costUsd += call.costUSD;
|
|
53
|
+
}
|
|
54
|
+
if (call.model)
|
|
55
|
+
byModel.set(call.model, (byModel.get(call.model) ?? 0) + n);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
return {
|
|
59
|
+
name: provider.name,
|
|
60
|
+
displayName: provider.displayName || providerDisplayName(provider.name),
|
|
61
|
+
today,
|
|
62
|
+
week,
|
|
63
|
+
month,
|
|
64
|
+
quarter,
|
|
65
|
+
models: [...byModel.entries()].sort((a, b) => b[1] - a[1]).map(([m]) => m),
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
/** Scan every agent (at most every 10 minutes unless forced) and save what each used. */
|
|
69
|
+
export async function refreshAgents(opts = {}) {
|
|
70
|
+
const now = opts.now ?? new Date();
|
|
71
|
+
const last = loadAgents();
|
|
72
|
+
if (!opts.force && last && now.getTime() - Date.parse(last.scannedAt) < AGENTS_MIN_INTERVAL_MS)
|
|
73
|
+
return last;
|
|
74
|
+
await prepareCodeburn();
|
|
75
|
+
const agents = [];
|
|
76
|
+
const failed = [];
|
|
77
|
+
for (const p of opts.providers ?? (await getAllProviders())) {
|
|
78
|
+
if (p.name === 'claude')
|
|
79
|
+
continue;
|
|
80
|
+
try {
|
|
81
|
+
const sources = await safeDiscoverSessions(p);
|
|
82
|
+
if (!sources.length)
|
|
83
|
+
continue;
|
|
84
|
+
const u = await usageFor(p, now, sources);
|
|
85
|
+
if (u.quarter.tokens > 0)
|
|
86
|
+
agents.push(u);
|
|
87
|
+
}
|
|
88
|
+
catch {
|
|
89
|
+
failed.push(p.name);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
agents.sort((a, b) => b.quarter.tokens - a.quarter.tokens);
|
|
93
|
+
const file = { scannedAt: now.toISOString(), agents, failed };
|
|
94
|
+
writeJson(filePath(), file);
|
|
95
|
+
return file;
|
|
96
|
+
}
|
package/dist/appstate.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
// What the Mac app reads (`chompyy state --json`) and the card actions it needs beyond the CLI's.
|
|
2
2
|
// The app holds no logic of its own: it shows this JSON and calls chompyy commands.
|
|
3
|
+
import { daytimeState } from './daytime.js';
|
|
3
4
|
import { execFileSync } from 'node:child_process';
|
|
4
5
|
import { readFileSync, existsSync } from 'node:fs';
|
|
5
6
|
import { clashOf } from './refresh.js';
|
|
@@ -15,20 +16,29 @@ import { loadColdStart } from './coldstart.js';
|
|
|
15
16
|
import { blueprintHash } from './picture.js';
|
|
16
17
|
import { costRange, readRuns } from './costs.js';
|
|
17
18
|
import { cachedWorkspaces, loadDream } from './dream.js';
|
|
19
|
+
import { learning } from './learning.js';
|
|
18
20
|
import { describeSignal, loadStore, nextQuestion, readSignals, receipts } from './taste.js';
|
|
19
|
-
import { agentInstalled, loadTriggerState } from './triggers.js';
|
|
21
|
+
import { agentInstalled, awayRunning, loadTriggerState } from './triggers.js';
|
|
22
|
+
import { nightcap } from './nightcap.js';
|
|
23
|
+
import { demonOffer } from './demon.js';
|
|
20
24
|
import { planFor } from './permissions.js';
|
|
21
25
|
import { loadProfile, preflightHosts } from './preflight.js';
|
|
22
26
|
import { gitRoot } from './workspace.js';
|
|
23
27
|
import { writeBlueprintFile } from './blueprint.js';
|
|
24
28
|
import { outboxes } from './send.js';
|
|
25
29
|
import { exe } from './exe.js';
|
|
30
|
+
import { warmCaches } from './nudge.js';
|
|
31
|
+
import { codexInstalled, loadCodexState } from './codexquota.js';
|
|
32
|
+
import { limitsState } from './agentlimits.js';
|
|
33
|
+
import { parseQuestions } from './questions.js';
|
|
26
34
|
export function cardView(card, runs = readRuns()) {
|
|
27
35
|
const qPath = card.run ? join(card.run.workdir, 'QUESTIONS.md') : '';
|
|
36
|
+
const questionsText = qPath && existsSync(qPath) ? readFileSync(qPath, 'utf8') : null;
|
|
28
37
|
return {
|
|
29
38
|
...card,
|
|
30
39
|
files: card.run ? changedFiles(card) : [],
|
|
31
|
-
questionsText
|
|
40
|
+
questionsText,
|
|
41
|
+
questions: questionsText ? parseQuestions(questionsText) : [],
|
|
32
42
|
pictureStale: Boolean(card.picture && card.picture.blueprintHash !== blueprintHash(card.blueprint)),
|
|
33
43
|
costRange: card.run ? null : costRange(card, runs),
|
|
34
44
|
folderBranch: card.column === 'review' && card.run?.branch ? (card.run.base?.branch || currentBranch(card.cwd)) : null,
|
|
@@ -59,6 +69,8 @@ export function currentBranch(cwd) {
|
|
|
59
69
|
export function appState(board, snap, config, now) {
|
|
60
70
|
const live = loadLiveState();
|
|
61
71
|
const runs = readRuns();
|
|
72
|
+
const pace = pacing(snap, loadSamples(), now, config.bedtime);
|
|
73
|
+
const approved = board.cards.filter((c) => c.column === 'approved').length;
|
|
62
74
|
return {
|
|
63
75
|
generatedAt: now.toISOString(),
|
|
64
76
|
quota: {
|
|
@@ -69,7 +81,7 @@ export function appState(board, snap, config, now) {
|
|
|
69
81
|
askKeychain: keychainAsk(config),
|
|
70
82
|
fiveHour: windowView(snap?.fiveHour, now),
|
|
71
83
|
sevenDay: windowView(snap?.sevenDay, now),
|
|
72
|
-
pacing:
|
|
84
|
+
pacing: pace,
|
|
73
85
|
},
|
|
74
86
|
gate: budgetGate(snap, config, now),
|
|
75
87
|
cards: board.cards.map((c) => cardView(c, runs)),
|
|
@@ -80,9 +92,59 @@ export function appState(board, snap, config, now) {
|
|
|
80
92
|
taste: tasteState(),
|
|
81
93
|
dream: dreamState(config, now),
|
|
82
94
|
pictures: config.pictures,
|
|
95
|
+
/** Conversations whose cache is still warm, soonest to expire first: the cookie steams while there are any. */
|
|
96
|
+
caches: safeWarmCaches(now),
|
|
83
97
|
triggers: { installed: agentInstalled(), lastHour: config.lastHourTrigger, bedtime: config.bedtime, ...loadTriggerState() },
|
|
98
|
+
/** The evening nightcap: offer to run approved cards at bedtime, or say what runs tonight. */
|
|
99
|
+
nightcap: nightcapNow(board, config, now),
|
|
100
|
+
/** Demon mode: eat what's left of the window before it resets. `auto` = the last-hour trigger runs it alone. */
|
|
101
|
+
demon: {
|
|
102
|
+
offer: demonOffer(windowView(snap?.fiveHour, now), pace.fiveHourForecast, approved, awayRunning() !== null),
|
|
103
|
+
auto: config.lastHourTrigger && agentInstalled(),
|
|
104
|
+
},
|
|
105
|
+
/** Other agents' limits beside Claude's: the app's provider switch. Only agents found on this Mac. */
|
|
106
|
+
providers: providersState(config, now),
|
|
84
107
|
};
|
|
85
108
|
}
|
|
109
|
+
/** Codex: whether it's here, whether you allowed the quota read, and its windows from the last check. */
|
|
110
|
+
export function providersState(config, now) {
|
|
111
|
+
const limits = limitsState(config.agentLimits ?? {});
|
|
112
|
+
if (!codexInstalled())
|
|
113
|
+
return { limits };
|
|
114
|
+
const s = loadCodexState();
|
|
115
|
+
return {
|
|
116
|
+
limits,
|
|
117
|
+
codex: {
|
|
118
|
+
allowed: config.codexQuota,
|
|
119
|
+
connection: s.connection ?? null,
|
|
120
|
+
plan: s.plan ?? null,
|
|
121
|
+
note: s.note ?? null,
|
|
122
|
+
capturedAt: s.capturedAt ?? null,
|
|
123
|
+
fiveHour: windowView(s.fiveHour, now),
|
|
124
|
+
sevenDay: windowView(s.sevenDay, now),
|
|
125
|
+
usage: s.usage ?? null,
|
|
126
|
+
},
|
|
127
|
+
};
|
|
128
|
+
}
|
|
129
|
+
export function nightcapNow(board, config, now) {
|
|
130
|
+
return nightcap({
|
|
131
|
+
now,
|
|
132
|
+
bedtime: config.bedtime,
|
|
133
|
+
bedtimeWindowMin: config.bedtimeWindowMin,
|
|
134
|
+
triggersOn: agentInstalled(),
|
|
135
|
+
approved: board.cards.filter((c) => c.column === 'approved').length,
|
|
136
|
+
fired: loadTriggerState().fired,
|
|
137
|
+
awayBusy: awayRunning() !== null,
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
function safeWarmCaches(now) {
|
|
141
|
+
try {
|
|
142
|
+
return warmCaches(now.getTime());
|
|
143
|
+
}
|
|
144
|
+
catch {
|
|
145
|
+
return [];
|
|
146
|
+
}
|
|
147
|
+
}
|
|
86
148
|
/** The nightly read for the app: on or off, the workspaces with their ticks, and how last night went. */
|
|
87
149
|
function dreamState(config, now) {
|
|
88
150
|
let workspaces = [];
|
|
@@ -106,7 +168,7 @@ export function tasteQuestion() {
|
|
|
106
168
|
* For "What Chompyy heard from you": the rules waiting for your yes (strongest evidence first) and the ones in
|
|
107
169
|
* force. The app shows the waiting count as a badge on the button.
|
|
108
170
|
*/
|
|
109
|
-
export function tasteState() {
|
|
171
|
+
export function tasteState(now = new Date()) {
|
|
110
172
|
const signals = readSignals();
|
|
111
173
|
const byId = new Map(signals.map((s) => [s.id, s]));
|
|
112
174
|
const store = loadStore();
|
|
@@ -123,7 +185,12 @@ export function tasteState() {
|
|
|
123
185
|
waiting.push(q);
|
|
124
186
|
rest.prefs = rest.prefs.filter((p) => p.id !== q.id);
|
|
125
187
|
}
|
|
126
|
-
return {
|
|
188
|
+
return {
|
|
189
|
+
waiting: waiting.map(item),
|
|
190
|
+
learned: store.prefs.filter((p) => p.status === 'active').map(item),
|
|
191
|
+
daytime: daytimeState().on,
|
|
192
|
+
learning: learning(store, signals, loadDream().readThrough ?? {}, waiting.length, now),
|
|
193
|
+
};
|
|
127
194
|
}
|
|
128
195
|
/** Whether the app should offer the cold start: never run, proposals waiting, or done. */
|
|
129
196
|
export function coldStartState() {
|
package/dist/away.js
CHANGED
|
@@ -7,7 +7,7 @@ import { formatDuration } from './duration.js';
|
|
|
7
7
|
import { budgetGate } from './gate.js';
|
|
8
8
|
import { homePath } from './home.js';
|
|
9
9
|
import { windowView } from './quota.js';
|
|
10
|
-
import { recordRun, usedBetween } from './costs.js';
|
|
10
|
+
import { costRange, readRuns, recordRun, usedBetween } from './costs.js';
|
|
11
11
|
import { applyPermissions } from './permissions.js';
|
|
12
12
|
import { tasteForPrompt } from './taste.js';
|
|
13
13
|
import { boxTempDirs } from './verify.js';
|
|
@@ -22,7 +22,9 @@ export function safetyRules(workdir) {
|
|
|
22
22
|
2. Nothing outward: no git push, merge, rebase or pull request; no sending email or messages, no posting,
|
|
23
23
|
no publishing packages, no purchases, no changes to remote services.
|
|
24
24
|
3. If you need a decision only the user can make, stop and write the question(s) to QUESTIONS.md in this
|
|
25
|
-
directory
|
|
25
|
+
directory. Don't guess on anything irreversible. The user picks an answer from a list, so for each question:
|
|
26
|
+
a "## " heading that asks it, one or two lines of why, then a line "Options:" and a numbered list of 2-4
|
|
27
|
+
options. Start each option with a short sentence saying what you'd do, and put "(Recommended)" on yours.
|
|
26
28
|
4. Stay inside the blueprint's scope. Don't commit: leave your changes as files in this directory. Chompyy
|
|
27
29
|
commits them to this folder's branch when you finish (the branch is how the user reviews and undoes it), and
|
|
28
30
|
the repo's .git is read-only to you. git status, git diff and git log work.
|
|
@@ -30,8 +32,9 @@ export function safetyRules(workdir) {
|
|
|
30
32
|
sandbox, so local commands like tests and scripts are fine. The sandbox has no network: don't install or
|
|
31
33
|
download anything (no npm install/ci, pip install, brew, curl). Dependencies the repo already has installed
|
|
32
34
|
are in place. If a check can't run without a download, don't retry it: say so in the CHECKS line.
|
|
33
|
-
6. End with a short summary: what you made, where it is, and how to check it.
|
|
34
|
-
|
|
35
|
+
6. End with a short summary: what you made, where it is, and how to check it. Then a line "RECIPE:" and under
|
|
36
|
+
it 2-3 lines starting with "- ", each saying what changed for the user in plain words: 12 words or fewer,
|
|
37
|
+
no file paths, line numbers or code. The very last line must be exactly one of:
|
|
35
38
|
CHECKS: passed — <what you ran>
|
|
36
39
|
CHECKS: failed — <what fails, and whether it failed before your change>
|
|
37
40
|
CHECKS: not run — <why you couldn't check>`;
|
|
@@ -130,6 +133,32 @@ export function parseChecks(output) {
|
|
|
130
133
|
return undefined;
|
|
131
134
|
return { result: last[1].toLowerCase(), why: last[2].trim() };
|
|
132
135
|
}
|
|
136
|
+
/** The plain steps under the agent's last "RECIPE:" line: what changed for the user, for the recipe card. At most 3. */
|
|
137
|
+
export function parseRecipe(output) {
|
|
138
|
+
const all = output.split('\n');
|
|
139
|
+
let at = -1;
|
|
140
|
+
all.forEach((l, i) => { if (/^\s*\**RECIPE:\**\s*$/i.test(l))
|
|
141
|
+
at = i; });
|
|
142
|
+
if (at < 0)
|
|
143
|
+
return [];
|
|
144
|
+
const steps = [];
|
|
145
|
+
for (const l of all.slice(at + 1)) {
|
|
146
|
+
const m = /^\s*(?:[-*]|\d+\.)\s+(.*)$/.exec(l);
|
|
147
|
+
if (!m) {
|
|
148
|
+
if (l.trim() === '' && steps.length === 0)
|
|
149
|
+
continue;
|
|
150
|
+
break;
|
|
151
|
+
}
|
|
152
|
+
const step = m[1].replace(/\*\*|`/g, '').trim();
|
|
153
|
+
if (step)
|
|
154
|
+
steps.push(step);
|
|
155
|
+
}
|
|
156
|
+
return steps.slice(0, 3);
|
|
157
|
+
}
|
|
158
|
+
/** The output without its RECIPE block, so the summary keeps to what was made and how to check it. */
|
|
159
|
+
function withoutRecipe(output) {
|
|
160
|
+
return output.replace(/^\s*\**RECIPE:\**\s*\n(?:\s*\n)?(?:\s*(?:[-*]|\d+\.)\s+.*(?:\n|$))*/gim, '');
|
|
161
|
+
}
|
|
133
162
|
function firstLines(text, n = 5) {
|
|
134
163
|
return text
|
|
135
164
|
.split('\n')
|
|
@@ -251,6 +280,12 @@ export async function runCard(id, timeoutMs, deps, trigger) {
|
|
|
251
280
|
const c = getCard(b, id);
|
|
252
281
|
c.column = 'running';
|
|
253
282
|
c.updatedAt = new Date(startedMs).toISOString();
|
|
283
|
+
const est = costRange(c, readRuns());
|
|
284
|
+
c.oven = {
|
|
285
|
+
since: c.updatedAt,
|
|
286
|
+
until: new Date(startedMs + timeoutMs).toISOString(),
|
|
287
|
+
...(est ? { expect: new Date(startedMs + Math.min(est.durationMidMs, timeoutMs)).toISOString(), from: est.n } : {}),
|
|
288
|
+
};
|
|
254
289
|
return { ...c };
|
|
255
290
|
});
|
|
256
291
|
out(`▶ #${card.id} ${card.title} (up to ${formatDuration(timeoutMs)})`);
|
|
@@ -260,6 +295,7 @@ export async function runCard(id, timeoutMs, deps, trigger) {
|
|
|
260
295
|
let status;
|
|
261
296
|
let exitCode = null;
|
|
262
297
|
let summaryText = '';
|
|
298
|
+
let recipe = [];
|
|
263
299
|
let checks;
|
|
264
300
|
let verified;
|
|
265
301
|
let tokens;
|
|
@@ -339,7 +375,8 @@ export async function runCard(id, timeoutMs, deps, trigger) {
|
|
|
339
375
|
? `Stopped by Chompyy: it was going in circles (${result.stuck}).`
|
|
340
376
|
: result.stalled
|
|
341
377
|
? `Stopped by Chompyy: ${result.stalled} (a hung command or a stalled agent), so the next card could run.`
|
|
342
|
-
: firstLines(result.output.replace(/^\s*CHECKS:.*$/gim, '')) || firstLines(result.stderr);
|
|
378
|
+
: firstLines(withoutRecipe(result.output).replace(/^\s*CHECKS:.*$/gim, '')) || firstLines(result.stderr);
|
|
379
|
+
recipe = parseRecipe(result.output);
|
|
343
380
|
log = `# prompt\n\n${prompt}\n\n# output\n\n${result.output}\n\n# stderr\n\n${result.stderr}\n`;
|
|
344
381
|
}
|
|
345
382
|
catch (err) {
|
|
@@ -363,6 +400,7 @@ export async function runCard(id, timeoutMs, deps, trigger) {
|
|
|
363
400
|
updateBoard((b) => {
|
|
364
401
|
const c = getCard(b, id);
|
|
365
402
|
c.column = 'review';
|
|
403
|
+
delete c.oven;
|
|
366
404
|
c.updatedAt = new Date(finishedMs).toISOString();
|
|
367
405
|
c.logPath = logPath;
|
|
368
406
|
c.run = {
|
|
@@ -376,6 +414,7 @@ export async function runCard(id, timeoutMs, deps, trigger) {
|
|
|
376
414
|
...(ws?.base ? { base: ws.base } : {}),
|
|
377
415
|
summary: summaryText,
|
|
378
416
|
...(checks ? { checks } : {}),
|
|
417
|
+
...(recipe.length ? { recipe } : {}),
|
|
379
418
|
cost,
|
|
380
419
|
...(verified ? { verified } : {}),
|
|
381
420
|
...(tokens ? { tokens } : {}),
|
package/dist/blueprint.js
CHANGED
|
@@ -128,9 +128,8 @@ export async function draftBlueprint(card, runner, opts) {
|
|
|
128
128
|
throw new Error(`claude exited with ${result.exitCode}: ${(result.stderr.trim() || result.output.trim()).slice(0, 300)}`);
|
|
129
129
|
return cleanBlueprint(result.output);
|
|
130
130
|
}
|
|
131
|
-
/** Most words
|
|
131
|
+
/** Most words a card title may have. Never cut by characters: a word cut in half reads as broken, and the board wraps titles. */
|
|
132
132
|
export const TITLE_MAX_WORDS = 10;
|
|
133
|
-
export const TITLE_MAX_CHARS = 60;
|
|
134
133
|
export function titlePrompt(idea) {
|
|
135
134
|
return `Write a short title for this task card on a kanban board. Reply with ONLY the title: at most ${TITLE_MAX_WORDS} words,
|
|
136
135
|
no quotes, no ending period, no preamble. Say what the task is about, e.g. "Retitle parked cards with a model summary".
|
|
@@ -139,7 +138,7 @@ Task: ${idea}`;
|
|
|
139
138
|
}
|
|
140
139
|
/**
|
|
141
140
|
* The model's reply as a card title: first non-empty line, without quotes, bullets, a "Title:" label or an
|
|
142
|
-
* ending period, cut to 10 words
|
|
141
|
+
* ending period, cut to 10 whole words. Empty when nothing usable is left.
|
|
143
142
|
*/
|
|
144
143
|
export function cleanTitle(output) {
|
|
145
144
|
const line = output.split('\n').map((l) => l.trim()).find((l) => l.length > 0) ?? '';
|
|
@@ -150,10 +149,7 @@ export function cleanTitle(output) {
|
|
|
150
149
|
.replace(/[.。]+$/, '')
|
|
151
150
|
.replace(/\s+/g, ' ')
|
|
152
151
|
.trim();
|
|
153
|
-
|
|
154
|
-
if (t.length > TITLE_MAX_CHARS)
|
|
155
|
-
t = t.slice(0, TITLE_MAX_CHARS - 1).trimEnd() + '…';
|
|
156
|
-
return t;
|
|
152
|
+
return t.split(' ').slice(0, TITLE_MAX_WORDS).join(' ');
|
|
157
153
|
}
|
|
158
154
|
/**
|
|
159
155
|
* A short title for the card, written by the same cheap model as the blueprint (no tools, one short call).
|
package/dist/board.js
CHANGED
|
@@ -143,6 +143,7 @@ export function continueCard(board, id, note, now, prior = {}) {
|
|
|
143
143
|
// The new cycle starts clean: these belonged to the run that just ended (and are kept in the Cycle).
|
|
144
144
|
delete card.run;
|
|
145
145
|
delete card.outcome;
|
|
146
|
+
delete card.unkept;
|
|
146
147
|
delete card.rating;
|
|
147
148
|
delete card.answers;
|
|
148
149
|
delete card.fiveStarOptions;
|
|
@@ -250,6 +251,7 @@ export function recoverRunning(board, now, where = () => ({ dir: '' }), why = 'T
|
|
|
250
251
|
const ws = where(c);
|
|
251
252
|
const startedAt = c.updatedAt || now.toISOString();
|
|
252
253
|
c.column = 'review';
|
|
254
|
+
delete c.oven;
|
|
253
255
|
c.updatedAt = now.toISOString();
|
|
254
256
|
c.run = {
|
|
255
257
|
status: 'error',
|
|
@@ -341,6 +343,8 @@ export function formatCard(c) {
|
|
|
341
343
|
lines.push(`log: ${c.logPath}`);
|
|
342
344
|
if (c.outcome)
|
|
343
345
|
lines.push(`outcome: ${c.outcome}`);
|
|
346
|
+
if (c.unkept)
|
|
347
|
+
lines.push(`undone after keep: ${c.unkept.how === 'revert-pr' ? `revert PR #${c.unkept.pr?.number ?? '?'}` : c.unkept.how === 'dropped' ? 'branch moved back' : 'Undo commit'}${c.unkept.closed ? `, PR #${c.unkept.closed} closed` : ''}`);
|
|
344
348
|
if (c.rating)
|
|
345
349
|
lines.push(`rating: ${c.rating.score}/5${c.rating.reason ? ` · ${c.rating.reason}` : ''}`);
|
|
346
350
|
return lines.join('\n');
|