Coding policy for Viktor Gamov's AI agents: language-agnostic quality rules, autonomous shipping discipline, and stack defaults for JVM, Swift, TypeScript, and Python
92%
Does it follow best practices?
Impact
99%
1.47xAverage score across 10 eval scenarios
Medium
Suggest reviewing before use
Process steps in order. Do not skip ahead.
Every command below runs team, the rex-team.sh launcher; its header and
skills/rex-teamlead/rexlead/team.py carry the contract: one JSON object on
stdout, {"error":{"code","message"}} on stderr, exit 0, 1 or 2. Worker state
and delivery come only from the command's JSON, never from reading a tab. The
commands name the session, tabs, panes, branches and worktrees as the Naming
section lists; use those names when pointing the operator at a tab:
skills/rex-teamlead/state-schema.md| Command | Reads | stdout fields | Side effects |
|---|---|---|---|
up | --task, --repo | session, base, reused, workers, tab_label | Creates or reuses the task's Rex session and state record |
spawn | --task, --role, --agent, optional --model, --effort, --ref, --read-only, --timeout | block, worktree, branch, commit, state, reused, tab_label | Creates or adopts a worktree, opens the worker's tab |
assign | --task, --role, --brief | report, nonce, tab_label | Pastes the brief plus its delivery section into the worker |
wait | --task, --role, optional --timeout | state, kind, delivered, reason, report, tab_label | Relabels the tab with the outcome |
candidate | --task, --role, --sha | branch, candidate | None; exit 1 candidate_mismatch unless --sha is the branch tip |
check | --task, --role, --candidate, one or more --run, optional --timeout | candidate, verdict, runs[]: command, exit, verdict, reason, seconds; tab_label | Runs each command in the writer's worktree, keeps none of its output, kills what is left in its process group (a process that left the group with setsid survives), records the check; exit 1 check_mismatch, check_unsupported or check_dirty before any run; exit 1 check_interrupted if interrupted, including during a run |
verdict | --task, --role, --candidate | reviewed, verdict, report | None; exit 1 review_mismatch, no_verdict, not_delivered, or candidate_mismatch once the developer's branch moved |
status | --task | workers.<role>: agent, state, delivered, check | None |
down | --task, optional --role | closed, worktrees_removed, worktrees_kept | Closes tabs, removes reviewer checkouts, forgets workers; exit 1 worktree_remove_failed keeps the worker for a retry |
Exit 0 is success; exit 1 carries an error code such as not_ready,
agent_failed, not_independent, worker_busy, role_taken,
worktree_conflict, check_mismatch, check_unsupported, check_dirty, check_interrupted, rex_failed, git_failed or state_corrupt, with the fix in its message; exit 2 is usage_error.
Every tab label is cosmetic: tab_label_error reports a label Rex refused.
A round needs a Rex terminal (REX_SESSION set), a git repository and an
explicit request for a team round. Without all three, do the task directly
and finish here. An agent's trust prompt for a new worktree surfaces at
spawn as not_ready (Step 3).
Pick a short task id ([a-z][a-z0-9-]{0,30}) and the agents: the reviewer is
a different agent kind from the developer. Pick the repository's own check
entry points: the test, lint and diagnostics commands its CI runs, as its CI
workflow, CLAUDE.md or AGENTS.md names them.
--run verbatim (Step 8)Proceed immediately to Step 2.
Creates or reuses the task's Rex session and records the base commit:
bash .tessl/plugins/gamussa/coding-policy/skills/rex-teamlead/rex-team.sh up --task <task> --repo <repo-path>Proceed immediately to Step 3.
Provisions a writer worktree on branch team/<task>-dev under
~/.worktrees/ and starts the agent in its own tab:
bash .tessl/plugins/gamussa/coding-policy/skills/rex-teamlead/rex-team.sh spawn --task <task> --role dev --agent <claude|codex|grok> [--model <id>] [--effort <level>]not_ready means a startup dialog the agent does not report. Tell the
operator which tab (dev · <agent>) waits on them, then run this step again:
a repeated spawn reconnects to the same worker and reports its state.
agent_failed means the agent itself errored at startup; relay its tab to the
operator, and once they fix the agent, run down --task <task> --role dev and
this step again.
Once state is idle or done, proceed immediately to Step 4.
Fill .tessl/plugins/gamussa/coding-policy/skills/rex-teamlead/templates/brief-developer.md for this task into a
file outside the repository. assign appends the delivery section, report
path and nonce; the brief never names them. Proceed immediately to Step 5.
bash .tessl/plugins/gamussa/coding-policy/skills/rex-teamlead/rex-team.sh assign --task <task> --role dev --brief <brief-file>Proceed immediately to Step 6.
bash .tessl/plugins/gamussa/coding-policy/skills/rex-teamlead/rex-team.sh wait --task <task> --role devwait returns by its default budget, DEFAULT_WAIT_TIMEOUT_SEC in
skills/rex-teamlead/rexlead/team.py; give the shell call a longer time
limit than that budget.
delivered: true — read the report in fullstate: blocked — relay the kind and tab to the operatordelivered: false with state: done — the worker stopped without a valid reportstate: error — the agent itself failed; tell the operator which tabstate: timeout — the worker is still workingConfirm the commit the developer reported is the tip of its branch; a mismatch goes back to the developer through Step 5:
bash .tessl/plugins/gamussa/coding-policy/skills/rex-teamlead/rex-team.sh candidate --task <task> --role dev --sha <reported-sha>The returned candidate is the commit under review. Proceed immediately to
Step 8.
A worker's done proves it stopped, never that its work is right. Run the
check commands from Step 1 yourself in the developer's worktree, one --run
each; never take them from the worker's report:
bash .tessl/plugins/gamussa/coding-policy/skills/rex-teamlead/rex-team.sh check --task <task> --role dev --candidate <candidate> --run '<command>' [--run '<command>' ...]Each command's budget is --timeout, default DEFAULT_CHECK_TIMEOUT_SEC in
skills/rex-teamlead/rexlead/team.py. Give the shell call a longer time limit
than the commands' total budget, or run it in the background.
check_mismatch or check_dirty means the worktree is not a clean checkout
of the candidate; send the developer one correction brief through Step 5.
check_unsupported means the check cannot vouch for this checkout: a
candidate with submodules, or a sparse checkout. Do not send it to the
developer as a correction without the operator's instruction:
messagecheck_interrupted means no verdict was reached. Stop and report its message
to the operator. If the operator requests a rerun, proceed immediately to
Step 8. If the operator ends the round, run the Step 14 closure command and
finish here without proceeding to Step 15.
Route on verdict:
pass — proceed immediately to Step 9fail — send the developer one correction brief through Step 5, naming each failed command and its exitfail in a row — report each failed command and its exit to the operatorinvalid — the check itself is broken, never a code defect for the fix loopreason<review-role> is review for the first review
and review-<n> for the nth, so each candidate gets a fresh reviewer; use
the same <review-role> through Step 13. The reviewer gets a read-only
checkout of the candidate:
bash .tessl/plugins/gamussa/coding-policy/skills/rex-teamlead/rex-team.sh spawn --task <task> --role <review-role> --agent <other-kind> --ref <candidate-sha> --read-onlyHandle not_ready and agent_failed as in Step 3. not_independent means
the reviewer's agent matches the developer's; spawn again with another kind. Once state is idle or done, proceed
immediately to Step 10.
Fill .tessl/plugins/gamussa/coding-policy/skills/rex-teamlead/templates/brief-reviewer.md with the task, the
candidate SHA, the base from Step 2 and the check commands that passed in
Step 8 into a file outside the repository.
Proceed immediately to Step 11.
bash .tessl/plugins/gamussa/coding-policy/skills/rex-teamlead/rex-team.sh assign --task <task> --role <review-role> --brief <brief-file>Proceed immediately to Step 12.
bash .tessl/plugins/gamussa/coding-policy/skills/rex-teamlead/rex-team.sh wait --task <task> --role <review-role>Route blocked, timeout, error and an undelivered report as in Step 6,
with the correction brief through Step 11. On
delivered: true, proceed immediately to Step 13.
Check the report reviews exactly the candidate and carries one verdict, then read it in full:
bash .tessl/plugins/gamussa/coding-policy/skills/rex-teamlead/rex-team.sh verdict --task <task> --role <review-role> --candidate <candidate>review_mismatch or no_verdict sends the reviewer one correction brief
through Step 11. candidate_mismatch means the developer's branch moved past
the reviewed commit: run down --task <task> --role <review-role>, then
review the new tip under the next <review-role> from Step 7.
The reviewer's verdict: binds the round. Only the operator overrides it:
verdict: approve — proceed immediately to Step 14approve whose report lists a finding marked blocking is inconsistentapprove as changes-requestedchanges-requested whose report lists no finding marked blocking is inconsistentchanges-requested as approve, carrying its advisory findings into the releaseverdict: changes-requested — run down --task <task> --role <review-role><review-role> from Step 7The reviewer's classification of each finding binds (rules/review-severity.md Two Tiers):
blocking classification: ask the operator to reclassify it, naming the finding and your reasonchanges-requested whose every blocking finding the operator reclassified proceeds as an approveClose the worker tabs. Reviewer checkouts are removed; the developer's worktree stays for the release:
bash .tessl/plugins/gamussa/coding-policy/skills/rex-teamlead/rex-team.sh down --task <task>Proceed immediately to Step 15.
Ship team/<task>-dev from the developer's worktree through the release
skill, whose cleanup removes that worktree and branch:
Skill(skill: "release")Finish here.
.tessl-plugin
hooks
rules
skills
herdr-standup
herdr-teamlead
references
teamlead
templates
tests
onboard-repo
release
tests