Merged
Conversation
- scripts/cost.sh aggregates `usage: N in / M out` lines across
tmp/trace/*.log and prints per-agent token totals + Opus 4.7 cost
estimate. Exposed via `npm run cost`.
- src/stub.ts provides isStub(agent): single entry point for the
stub-mode check. Honors NATEMPLATE_STUB_ALL=1 (every sub-agent
stubbed) or NATEMPLATE_STUB_<AGENT>=1 (per-sub-agent override).
- package.json test script now sets NATEMPLATE_STUB_ALL=1 so future
sub-agents inherit the behavior without touching the script.
- Planner refactored to call isStub("planner") instead of reading
the env var directly.
No behavior change for CI (still runs stubbed); docs-private/PLAN.md
gets a Status summary + Execution utilities section in a follow-up.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Small quality-of-life pass building on the Day 2 merge.
npm run cost— newscripts/cost.shparsestmp/trace/*.logforusage: N in / M outlines, aggregates per sub-agent, prints Opus 4.7 cost estimate. Useful while the Anthropic console lags 5–15 min.src/stub.ts— singleisStub(agent)helper. HonorsNATEMPLATE_STUB_ALL=1(everything stubbed) orNATEMPLATE_STUB_<AGENT>=1(per-sub-agent override).NATEMPLATE_STUB_ALL=1so future sub-agents inherit stub behavior without updatingpackage.jsoneach time.process.env[...]check withisStub("planner"). Matches the shape Day 3's rails worker will use.Gitignored
docs-private/PLAN.mdalso gets a "Status" summary + "Execution utilities" section in the working copy (not in this PR, since it's out-of-tree).Test plan
npm run ci— 5/5 tests pass underNATEMPLATE_STUB_ALL=1npm run dev -- "<spec>"— real planner runs correctly withNATEMPLATE_STUB_ALLunsetNATEMPLATE_STUB_ALL=1 npm run dev -- "<spec>"— planner takes stub path, trace log confirmsnpm run cost— prints table with planner row summing prior test-run usages; returns 0 gracefully when no traces exist yet