Skip to content

feat(low-token): add --low-token mode for Pro/student plans#57

Merged
SamPlvs merged 1 commit into
mainfrom
claude/lucid-herschel-fece72
Apr 26, 2026
Merged

feat(low-token): add --low-token mode for Pro/student plans#57
SamPlvs merged 1 commit into
mainfrom
claude/lucid-herschel-fece72

Conversation

@SamPlvs
Copy link
Copy Markdown
Owner

@SamPlvs SamPlvs commented Apr 26, 2026

Summary

  • New --low-token CLI flag (and low_token: true plan YAML field) activates a cost-saving preset: Sonnet lead instead of Opus, max-iterations 2 instead of 10, full-auto gates, no Haiku headlines, earlier auto-compaction (CLAUDE_AUTOCOMPACT_PCT_OVERRIDE=60). Estimated ~70-80% reduction (MNIST: ~$11 → ~$2-3).
  • Override flags --lead-model {opus,sonnet,haiku}, --max-iterations N, --no-headlines compose with the preset. Precedence: CLI > plan > preset > base default.
  • Comprehensive documentation: new concepts/low-token-mode.mdx (FAQ + comparison + worked examples), reference/low-token-preset.mdx (one-page card), reference/cost-benchmark.mdx (methodology). Updates across the-plan.mdx, cli/{overview,build}.mdx, quickstart.mdx, introduction.mdx, mint.json, README.md, COMMANDS.md.
  • Benchmark harness scripts/benchmark_low_token.sh for measured MNIST cost comparison (one-time run; pending).
  • Bug fix: docs/concepts/the-team.mdx frontmatter title was stale "Agents" (legacy from concepts/agentsconcepts/the-team rename); now matches file path / nav. Resolves user-reported 404 on Mintlify cached deploys. README test-count badge synced 675 → 704.
  • README "Built on" acknowledgements section: 11 deps (Claude Code, Pydantic, Click, Rich, nbformat, PyYAML, FastEmbed, uv, Ruff, Astro, Mintlify) + 3 planned optional integrations (ccusage, Repomix, caveman).
  • +29 tests across 5 unit files + new integration test. 704 total + 7 skipped. ruff src/zo/ clean. validate-docs 10/10.

Out of scope (deliberately)

Prompt caching, Batch API, Files API, extended thinking budgets — all require switching ZO from claude CLI launcher to direct Anthropic SDK. Substantial refactor, separate PR conversation. The architectural constraint is the answer for v1 of this feature.

External-tool integrations (caveman, Repomix, ccusage, claude-code-cache-fix) deferred to follow-up PRs after the internal preset gets real-world validation. Acknowledged in README as "Optional integrations (planned)".

Test plan

  • uv run pytest -q — 704 + 7 skipped pass
  • uv run ruff check src/zo/ — clean
  • ./scripts/validate-docs.sh — 10/10
  • uv run zo build --help--low-token, --lead-model, --max-iterations, --no-headlines render with descriptions
  • uv run zo continue --help — same four flags present
  • Banner badge: invoke _show_banner(low_token=True) shows [low-token] text
  • Plan frontmatter: parse a plan with low_token: true and lead_model: sonnet; verify both fields land on PlanFrontmatter
  • Precedence: CLI flag wins over plan field; plan ## Experiment Loop max_iterations: 8 wins over low-token clamp of 2; --max-iterations 4 CLI override wins over plan + preset
  • Mintlify dev preview: cd docs && mintlify dev — confirm new pages render under "Concepts" and "Reference" groups; "the team" page resolves with title "The team"
  • Pending: end-to-end MNIST benchmark via ./scripts/benchmark_low_token.sh (~$13-14 spend, ~75min wall time) — scheduled follow-up agent (2026-05-10) will pick up the results once a benchmark-results-*.json is committed to the repo

🤖 Generated with Claude Code

A single CLI flag (--low-token) and matching plan field (low_token: true)
activate a cost-saving preset: Sonnet lead instead of Opus, max-iterations
2 instead of 10, full-auto gates, no Haiku headlines, earlier auto-
compaction. Estimated ~70-80% reduction (MNIST: ~$11 → ~$2-3).

Override flags (--lead-model, --max-iterations, --no-headlines) compose
with the preset. Precedence: CLI > plan > preset > base default.

Comprehensive docs: new concepts/low-token-mode.mdx (FAQ, comparison,
worked examples), reference/low-token-preset.mdx (one-page card),
reference/cost-benchmark.mdx (methodology). Updates across the-plan.mdx,
cli/overview.mdx, cli/build.mdx, quickstart.mdx, introduction.mdx,
mint.json, README.md, COMMANDS.md.

Benchmark harness scripts/benchmark_low_token.sh for measured MNIST cost
comparison (one-time run; pending).

Bug fix: docs/concepts/the-team.mdx frontmatter title was stale "Agents"
(legacy from concepts/agents → concepts/the-team rename), now matches
file path / nav. README test count badge synced 675 → 704.

README "Built on" acknowledgements section: 11 deps + 3 planned optional
integrations (ccusage, Repomix, caveman).

+29 tests across 5 unit files + new integration test (704 total + 7
skipped). ruff src/zo/ clean. validate-docs 10/10.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@mintlify
Copy link
Copy Markdown

mintlify Bot commented Apr 26, 2026

Preview deployment for your docs. Learn more about Mintlify Previews.

Project Status Preview Updated (UTC)
personal-6078e1c9 🟢 Ready View Preview Apr 26, 2026, 8:37 PM

💡 Tip: Enable Workflows to automatically generate PRs for you.

@cloudflare-workers-and-pages
Copy link
Copy Markdown

Deploying zero-operators with  Cloudflare Pages  Cloudflare Pages

Latest commit: d4eef54
Status: ✅  Deploy successful!
Preview URL: https://7b590292.zero-operators.pages.dev
Branch Preview URL: https://claude-lucid-herschel-fece72.zero-operators.pages.dev

View logs

@SamPlvs SamPlvs merged commit be59379 into main Apr 26, 2026
2 checks passed
@SamPlvs SamPlvs deleted the claude/lucid-herschel-fece72 branch April 26, 2026 20:38
SamPlvs added a commit that referenced this pull request Apr 27, 2026
Root cause of the persistent /concepts/the-team 404 on
docs.zerooperators.com identified via direct HTTP probe:

- Sibling pages return 200 (`/concepts/the-plan` etc.) — Mintlify
  build is current and serving fresh content.
- `/concepts/the-team` returns 404 specifically — the page failed
  to compile, Mintlify excluded it from the build output.

Cause: line 51 of the-team.mdx contained "files <500 lines,
functions <50 lines" in prose. MDX 2's parser treats `<`
followed by any non-whitespace as a JSX opening tag (digit is
non-whitespace). `<500` becomes a malformed JSX attempt, the
whole file fails compilation.

Fix: replace `<500` / `<50` with natural-prose `under 500` /
`under 50`. Same semantic meaning, parses cleanly. CLAUDE.md
already uses the "under N lines" phrasing — this aligns the
public docs with the source-of-truth coding-conventions text.

Repo-wide sweep (see commit message body) confirms this was the
only such pattern in any tracked .mdx file. After PR merges +
Mintlify auto-redeploys, /concepts/the-team should return 200.

Bonus fix in same commit: README test badge `tests-675_passing`
→ `tests-704_passing` was already done in PR #57; this commit
also corrects a separate stale URL — README docs badge + docs/
README + STATE.md still referenced `docs.zero-operators.dev`
(the originally-planned URL) instead of the actual deployed
`docs.zerooperators.com` (no hyphen). Updated three files.
DECISION_LOG entry for original Mintlify framework decision
left intact as historical audit; STATE.md now records both the
planning URL and the actual deploy URL with a note explaining
the change.

706 tests pass + 7 skipped. ruff src/zo/ clean. validate-docs
10/10 (1 pre-existing test-count warning).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
SamPlvs added a commit that referenced this pull request Apr 27, 2026
…ch pending

Records the session-024 work and explicitly verifies that agent teams
mode (tmux launch + TeamCreate + Agent(team_name=...) + peer-to-peer
SendMessage) is preserved across both default and low-token modes.

STATE.md "Current Position" rewritten to lead with the session-024
hand-off so the next session picks up cleanly: PR #58 status (open +
mergeable, 3 commits), the team-page 404 root cause + fix, the
sub-agent model override fix, and the next manual action (mini-bench
to verify whether Claude Code's Agent() honours the model parameter).

DECISION_LOG appended with three new entries:
1. MDX dollar-sign rendering bug — escaped $ → \$ in 9 prose locations
2. Sub-agent model override architecture — _prompt_low_token_overrides()
3. the-team 404 root cause — MDX 2 prose <500 lines parser bug + URL
   correction (docs.zero-operators.dev → docs.zerooperators.com)

New session summary at memory/zo-platform/sessions/session-024-2026-04-26.md
covers the full session arc: PR #57 (merged) + PR #58 (open) feature
list, partial bench findings, regression check proof, hand-off
instructions for picking up the work.

Test snapshot: 706 passed + 7 skipped. ruff src/zo/ clean.
validate-docs 10/10 (1 pre-existing test-count warning).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
SamPlvs added a commit that referenced this pull request Apr 30, 2026
feat(low-token): add --low-token mode for Pro/student plans
SamPlvs added a commit that referenced this pull request Apr 30, 2026
Root cause of the persistent /concepts/the-team 404 on
docs.zerooperators.com identified via direct HTTP probe:

- Sibling pages return 200 (`/concepts/the-plan` etc.) — Mintlify
  build is current and serving fresh content.
- `/concepts/the-team` returns 404 specifically — the page failed
  to compile, Mintlify excluded it from the build output.

Cause: line 51 of the-team.mdx contained "files <500 lines,
functions <50 lines" in prose. MDX 2's parser treats `<`
followed by any non-whitespace as a JSX opening tag (digit is
non-whitespace). `<500` becomes a malformed JSX attempt, the
whole file fails compilation.

Fix: replace `<500` / `<50` with natural-prose `under 500` /
`under 50`. Same semantic meaning, parses cleanly. CLAUDE.md
already uses the "under N lines" phrasing — this aligns the
public docs with the source-of-truth coding-conventions text.

Repo-wide sweep (see commit message body) confirms this was the
only such pattern in any tracked .mdx file. After PR merges +
Mintlify auto-redeploys, /concepts/the-team should return 200.

Bonus fix in same commit: README test badge `tests-675_passing`
→ `tests-704_passing` was already done in PR #57; this commit
also corrects a separate stale URL — README docs badge + docs/
README + STATE.md still referenced `docs.zero-operators.dev`
(the originally-planned URL) instead of the actual deployed
`docs.zerooperators.com` (no hyphen). Updated three files.
DECISION_LOG entry for original Mintlify framework decision
left intact as historical audit; STATE.md now records both the
planning URL and the actual deploy URL with a note explaining
the change.

706 tests pass + 7 skipped. ruff src/zo/ clean. validate-docs
10/10 (1 pre-existing test-count warning).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
SamPlvs added a commit that referenced this pull request Apr 30, 2026
…ch pending

Records the session-024 work and explicitly verifies that agent teams
mode (tmux launch + TeamCreate + Agent(team_name=...) + peer-to-peer
SendMessage) is preserved across both default and low-token modes.

STATE.md "Current Position" rewritten to lead with the session-024
hand-off so the next session picks up cleanly: PR #58 status (open +
mergeable, 3 commits), the team-page 404 root cause + fix, the
sub-agent model override fix, and the next manual action (mini-bench
to verify whether Claude Code's Agent() honours the model parameter).

DECISION_LOG appended with three new entries:
1. MDX dollar-sign rendering bug — escaped $ → \$ in 9 prose locations
2. Sub-agent model override architecture — _prompt_low_token_overrides()
3. the-team 404 root cause — MDX 2 prose <500 lines parser bug + URL
   correction (docs.zero-operators.dev → docs.zerooperators.com)

New session summary at memory/zo-platform/sessions/session-024-2026-04-26.md
covers the full session arc: PR #57 (merged) + PR #58 (open) feature
list, partial bench findings, regression check proof, hand-off
instructions for picking up the work.

Test snapshot: 706 passed + 7 skipped. ruff src/zo/ clean.
validate-docs 10/10 (1 pre-existing test-count warning).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant