lean-sprint
Run one ticket or scoped task as a lean sprint: cheap Searcher, optional architect, fresh developer, milestone review. Use when the user hands over a ticket or scoped task to execute. Not for questions or conversation.
Two-Agent Lean Fresh-Handoff Sprint
Orchestrate a lean, milestone-driven sprint with a cheap read-only searcher, optional read-only architect refinement, focused developer, strict zero-coding review, and single-ticket pre-work batching.
Reference Practice: @docs/AgenticLoop.md
Role Contract — Direct Execution
You, the agent that received this invocation, are the Host Orchestrator for this task. Run the complete lean workflow below yourself in this session: goal handoff, sequential milestone dispatch, concise pre-commit/milestone review, and teardown with status sync.
Strict Invariants for the Host Orchestrator
-
One-Level Delegation: start helpers only as
--role advisor|developer|reviewer; they are leaf workers and never callharnez agent. Never start another orchestrator or hand the sprint to another agent. -
Zero Coding:
- The Host Orchestrator NEVER writes code, edits source files, or applies "quick fixes" directly.
- All code implementation, file editing, test creation, and bug fixing are strictly executed by the dispatched developer agent.
-
Diff-First Inspection (No Exploratory Code Digging):
- The Host Orchestrator NEVER performs exploratory repository digging: no broad grep, whole-file reading, API/spec research, or call-graph tracing.
- The host reads the task and bounded reports, then reviews the developer's commit diff (
git log -n 1 --stat,git diff HEAD~1) and test output. Discovery belongs to the Searcher, except for the bounded Developer plan permitted by §1; implementation discovery belongs to the Developer.
-
Single-Ticket Communication (No Follow-Up Tickets):
- The single target issue ticket (
issues/XXX-....md) is the sole medium of communication between the host and developer. - Do NOT create secondary nuance refinement tickets (
#XXX-refinements) or splinter follow-up tickets for lean sprints. - Discovered nuances and fixes from milestone $N$ are written directly into the ticket under milestone $N+1$ as Pre-Work. Never dispatch isolated micro-tasks to the developer.
- The single target issue ticket (
-
Low-Risk Decisions: Decide simple, low-risk or reversible choices yourself; record each choice and reason under
## Decisionin the ticket and report it in one line naming that location. Ask only about destructive or irreversible actions, unauthorized outward-facing actions, breaking API changes, or security choices with real exposure; model choices remain the user's.
Invocation Syntax
/lean-sprint <ticket-numbers>(e.g./lean-sprint 064or/lean-sprint 042, 043)/lean-sprint "<scoped-task-or-bug-description>"/lean-sprint <ticket> refined <tier>(orwith architect,with advisor, or an explicitly named model)- The legacy single-developer workflow is available as
/lean-sprint-v1 <ticket-or-task>.
Lean Milestone-Review Workflow
For focused, milestone-based tasks, execute this fast-path, token-efficient loop:
1. Bounded Discovery with the Cheap Searcher
- Start with the ticket and dispatch a read-only Searcher (
--role advisor --model cheap) for a bounded audit: verify the ticket premise, locate relevant files and exact line ranges, answer specific questions, explore APIs/specs, or search the web. Give a small question list and return format; do not ask it to implement, edit files, run mutating commands, or commit. Use a prompt file for longer questions. - Skip the Searcher when the ticket was just refined against live code in this sprint and already cites exact file:line causes; say so in the sprint report.
- Also skip the Searcher for a narrowly scoped ticket that identifies the exact file and function, documents the complete expected write set (including tests/docs), and leaves no unresolved premise, scope, or architecture questions. Require a plan-only first Developer turn that inspects live code, verifies the premise and current locations, and confirms the write set; file:line citations alone do not qualify. The host must review the concrete findings before granting writes and reconsider developer/model choice. If inspection reveals stale assumptions, missing files, or scope uncertainty, run the Searcher before implementation. Record the skip and findings in the sprint report.
- When used, run the Searcher sequentially before the Developer. The host reads its concise findings and decides what the Developer needs; the host does not repeat discovery by browsing the repository.
- A Searcher reused from an earlier round: after a large search round, compact it before the next resume with
HTO=0 harnez agent compact --name <searcher>, so compaction happens between rounds rather than mid-search.
1.5. Optional Architect Refinement
- When the user asks for a lean sprint "with an advisor", they mean this architect step, not the Searcher (both run as
--role advisor). - Run this step when the user explicitly requests refinement or confirms the host's proactive suggestion. If refinement was not requested, suggest it when Searcher findings show complex architecture such as multi-system boundaries, API/schema redesign, or non-trivial component trade-offs.
- Default to
--role advisor --model smartfor the architect. If the user names a model or tier, dispatch that exact choice and report failures without substituting another model. - Dispatch the architect as
--role advisorwith read-only instructions. It returns a structured architecture, milestones (M1,M2, ...), boundary constraints, edge cases, and pre-work requirements; it does not implement, edit files, or run mutating commands. - The host records the architect's milestones, boundaries, edge cases, and pre-work in the target ticket before handing it to the Developer. The host remains subject to the Zero Coding invariant above.
2. Goal Handoff to Focused Developer
- The Host Orchestrator dispatches one developer worker (
--role dev --model leanfor standard work,--role dev --model stdfor moderate work,--role dev --model smartfor complex work,--role dev --model fastfor easy work, or--role dev --model cheapfor low-cost work) usingharnez agent start --role developer --name <worker> --model <model> -d <dir> -f <prompt-file>(or the active dispatch method), run withHTO=0as one session-background job per the host table inharnez agent start --help(Claude Code: Bash withrun_in_background: true).run_in_background: Claude Code Bash tool parameter only; not a harnez flag. Use a prompt file for long or complex handoffs instead of a long inline shell argument. Report the job id and session name to the user; the job's exit is the only completion signal, so never promise a review without it. Haiku 5.5 input above 100k tokens costs 5x (Claude model configuration); harnez compacts Haiku at 80k by default; override viaagent.compact_thresholds(issue 969; docs/AutoCompaction.md). High thinking effort fills that budget quickly. - An explicitly named
provider:model:tiermust be dispatched exactly throughharnez agent start; on failure, report it and ask for guidance rather than substituting the host model or a native subagent. - Provide these facts in every handoff (a required checklist, not a wording template; missing items caused most follow-up turns):
- Ticket number and goal, with its acceptance criteria.
- Files to change, all of them (including doc copies and sibling docs).
- Files not to touch (other sessions' uncommitted work) — never stage them.
- Tests already known to fail and why, so the worker neither fixes nor blames them.
- Edge and negative cases to test (ambiguous input, near-miss values).
- Test requirements (reproduction test first for bugs, unit tests for features).
- External-contract tests: expected values from the real tool, see AgenticLoop.
- If
.harnez/repo.yamlsetsissues.tracker: none, follow.harnez/rules/Index.mdfor the local-tracker/session fallback. - The exact close command with a written reason:
harnez issues close N "<real outcome>"; no placeholders. The close refuses until a commit outsideissues/names N;--no-codeonly for a ticket that needed no code. Close only after the ticket's acceptance check passes; the reason states the decisive evidence (the key numbers or check result), not a pasted log. When acceptance is not met, leave the ticket open and report. (Sprint 850: closed with a false match still above the cutoff.) - Never amend, autosquash or rebase commits; fix with new commits. Other sessions push to the same main. (Bug-hunt 2026-10-22: an autosquash rewrote pushed commits and blocked every ticket commit.)
- Plan First (read-only): Recommended: start the worker's initial prompt with a read-only planning step ("read-only: plan ..."; no edits until the host has seen the plan), then
resumeto grant write authority. Give no wording template for the prompt beyond the checklist above: agents have their own best practices, and the stored first prompts (telemetry DB) are how we observe and compare them. In one-shot mode a plan request alone is not enforced, so a plan-only first prompt is the reliable form. Codex workers often end the plan turn right afterCONFIRM:without inspecting (seen twice on 2026-09-30): ask for "inspect now and reply with the concrete plan (files, schema, checks, commits) in this turn", and if the reply is only a plan-to-plan, resume once with that request. This step is mandatory when using §1's Developer-plan discovery exception. - Trust the Base Framework: Do not duplicate system prompts or micromanage formatting conventions.
- Reading Discipline: Instruct the developer to use line-bounded reads (
harnez read -L <range>/-n) for medium/large files (harnez read -Iis paused until issue 543, a memory blow-up, is fixed). - Stay Responsive: Dispatching the worker must not block the chat; note the emitted Reconnect Banner and return control or proceed with review preparation.
3. Autonomous Milestone Execution & Commit
- Git mode: Before Dev, read
git.modein.harnez/repo.yaml(key absent = solo). If it isn't solo, create or reusesprint/<tickets>; never commit sprint work to the default branch. The final step pushes the branch and reports the PR URL (the host opens it with tea/gh), instead of committing to main. - The developer agent implements the milestone autonomously.
- Follows Test-Driven Development (TDD) and executes repo-native verification (
go test ./...,make test). - Under a one-run test budget, use
make test-q1when available; otherwise runharnez exec --quota-1 -- <repo-test-command>. Write full output to a file and grep for--- FAIL; never pipe it intotail. Before committing, quote the run's final test summary line in the report: no--- FAILin a run that stopped early (e.g. at gofmt or vet) is not a pass (941 M4 committed after a run that never reached the tests). A failure in an untouched test gets its own ticket instead of a loosened assertion. After fixing a failure from that run, rerun only the touched packages and report that the full run is owed; the host runs it before review (issue 896). If that host run fails, the host fixes nothing: it records the failure as pre-work in the ticket and resumes the developer. - Immediately commits the verified milestone at the boundary (
git commit -m "... (issue XXX MX)"). - Reports completion back to the Host Orchestrator. Name each milestone or ticket at least once with a short label, e.g. "M3 (single-write removal)", not bare "M3" (
@docs/AgenticLoop.md§4, Status reports).
4. Concise Milestone Review & In-Ticket Pre-Work Embedding
- Upon developer milestone completion, the Host Orchestrator performs a rapid, diff-only inspection:
- Run
git fetchandgit status -sbfirst: a local main that diverged from origin means history was rewritten or another session pushed; resolve that before reviewing. - Check
git log -n 1 --stat,git diff HEAD~1, and run verification tests. - After the developer's green full run, rerun only touched packages (
go test <pkgs>); run a full suite only if the developer did not run one, at release, or with the user's authorization. - Evaluate test assertion rigor, ambient environment leaks, and edge-case omissions directly against the diff.
- The host/reviewer reads every changed assertion line in test diffs; a "fixed the test" report can hide a
weaker check (884:
HasPrefix→Containsdropped the ordering the test name promised). - Plausibility check for measurements: when the milestone produces numbers (reports, stats, benchmarks, token or quota figures), run the real command and check the values make sense, not only that tests pass: units and magnitudes against a known reference or hand calculation, totals that add up, parts that don't exceed the whole, no field holding another field's data, no silent zeros for missing data, and no rows that vanish. Record implausible values as pre-work for the next milestone. (Sprint 519: green tests hid "new input" holding total input and a 43% drain on one session.) Before a reviewer's number becomes an expected value in pre-work, check it against the raw source. (878 M3: pre-work said "expect 119" from a reviewer count; the raw JSONL gave 128.)
- For user-visible output, the host runs the installed binary itself (several runs, a pty for
interactive views) and compares every expected row. A developer's pasted output or "closed" is
not evidence. (Sprint 657: a dev closed the ticket claiming all providers rendered; live compact
showed none of Claude/Codex, and rows varied between runs.)
The same holds for any output form: when the evidence is web screenshots, the host opens each
variant itself (dark scheme, phone width), and variants come from the real user setting (the
browser's color scheme), not one forced inside the page. (harnez.org 028 M2.4: a dev reported 32
screenshots fine; every "dark" one was light because only a forced
data-themewas ever tested.) - Test services the first minute after start to surface readiness, catch-up, and heartbeat bugs.
(Sprint 714:
harnez usagehung after every server restart; tests always started with data.) - When the change touches generated, rendered or git-integration files, the host runs
make install && harnez init -d .and requires a cleangit status; for git integration it also runs the real flow in a scratch repo and checksgit show HEAD:<file>. (Sprints 843/847: init reverted M3's rules edit; green tests hid a driver that init never installed and merge commits missing rows.)
- Run
- Strictly No Direct Fixes & No Micro-Task Rounds:
- The host does NOT modify code files.
- The host updates the ticket: records milestone $N$ delivery summary, naming the milestone ("M2 delivered: flag and schema gating").
- If adjustments, test hardenings, or nuances are required, the host documents them directly in the ticket under Milestone $N+1$ as "Pre-Work / Required Refinements".
- Commit the ticket update immediately. Resume the developer only after that edit and commit succeeded, in a later call, never chained in the same batch. (878: a pre-work edit on a wrong path nearly sent the developer to a section that did not exist.)
5. Milestone Advance or Completion
- The developer agent picks up the updated ticket for Milestone $N+1$ (resumed via
harnez agent resume --name <session_id> "<pre_work_and_milestone_prompt>"or native subagent message), executes the embedded pre-work first, and then proceeds with Milestone $N+1$ implementation. - Repeat Steps 1–3 for each milestone.
- Once the final milestone passes concise review and tests are 100% green, confirm completion.
- In team/protected mode, push
sprint/<tickets>and report the PR URL (the host opens it with tea/gh);mainis never pushed. - Before a ticket closes, the host/reviewer compares what was delivered with the ticket's
/goaland the milestone plan; a shortfall is parked in its own ticket and named in the close reason (884 M9 moved 157 of ~5k planned lines and was first closed as delivered).
6. Teardown, Study Report & Status Sync
- Terminate the developer subagent and every research or probe helper (
harnez agent delete --name <session_id>ormanage_subagents kill) and drain background jobs;harnez agent listshould show none left. - If
.harnez/repo.yamlsetsissues.tracker: none, follow.harnez/rules/Index.md; otherwise update ticket status and refresh the Harnez index. - Maintain a running report in
docs/studies/when enabled by.harnez/repo.yaml; otherwise follow.harnez/rules/Index.mdfor the local-docs/session fallback. Use a date-prefixedtwo-agent-lean-sprintfilename and short task slug, with front matterkind: sprint(see/study). The Host Orchestrator records the Searcher questions/findings, Developer milestones and commits, verification outcomes, and observed token/time efficiency as the sprint progresses; do not reconstruct it only at the end. - Output a brief, high-level summary of delivered milestones and verification status. Name each milestone or ticket at least once with a short label, e.g. "M3 (single-write removal)", not bare "M3" (
@docs/AgenticLoop.md§4, Status reports).
These are the shipped picks. User models.yaml overrides are listed by harnez agent models --picks.
| Role | Trait | Meaning | Chain | Default | |---|---|---|---|---| | advisor | cheap | Low-cost work. | luna:low, haiku:low | yes | | advisor | smart | Difficult judgment. | opus:low, opus:med, sol:low | | | developer | ai | AI-oriented work. | unset | | | developer | cheap | Low-cost work. | luna:med | | | developer | fast | Fast work. | haiku:med | | | developer | gui | Graphical interfaces. | lean, std | | | developer | lean | Efficient standard work. | terra:low | yes | | developer | smart | Difficult judgment. | sol:med, opus:med | | | developer | std | Standard work. | terra:med, opus:low | | | developer | tui | Terminal interfaces. | smart | | | reviewer | smart | Difficult judgment. | sol:low | yes |
- Content
- file-backed
- License:
- AGPL-3.0-or-later
- Origin
- first-party
- Source:
- docs/commands/lean-sprint.md
- Source revision
3cb914dfaf6c43cbbbc43868d6b47c2cc7516c22- Requires
- Targets
- codex, claude
- Invocation
- /lean-sprint
Related skills
- bug-hunt — Run a bug hunt over active P1/P2 bug tickets: re-verify each against live code, close obsolete ones, fix the rest the way forward. Only on explicit /bug-hunt or 'bug hunt'.
- decide — Session-scoped autonomy for the orchestrating agent: answer simple questions yourself, consult cheap or smart advisors, push ready work without asking, and stop only for very critical questions. Only on explicit /decide.
- docup — Review and update bounded repository documentation by category (testing, architecture)
- epic — Plan, refine and run epics with open-epic checks, affinity grouping, internal goal setting, and file/run/next modifiers. Only on explicit /epic or 'epic'.