SCHEMA — tools/jev¶
JEV, the harness-level agent logic engine: the assign-at-merge numbering compiler (
number.py), the ratification and acceptance recorder (ratify.py), the tiered pull-request conflict triage and resolution engine (conflicts.py,classify.py,ledger.py), the expedite sprint's ceiling and circuit breaker (sprints.py), the loop step specs (spec.py,steps/), the headless Claude Code executor layer (headless.py), the local loop runner built on them (loop.py,workspace.py,adapters/), its context pack (context.py), and recursive harness refinement (surface.py,library.py,refine.py,reflect.py,missions/). Entry pointpython3 -m tools.jev; docdocs/JEV.md.
Conventions¶
- Python 3.12, stdlib + PyYAML. Every GitHub call goes through
common.gh, which refuses--adminand refusespr merge; every subprocess returns aRunrather than raising, because a failing trial merge is data. - A module is importable with no side effects: configuration is read when a function asks for it, never at import.
- Tests live beside the other hub gates as
tools/test_jev_*.py(collected byrun-all-tests.shandpython-tests.yml), not in this directory.
Structure¶
| entry | kind | purpose | rules |
|---|---|---|---|
README.md |
file | How to run JEV, set up the merge driver, and read the tier ladder | required |
__init__.py |
file | Package marker and version | required |
__main__.py |
file | The CLI entry point — the number, ratify, conflicts, generated, steps, loop and refine command groups |
required |
common.py |
file | Hub paths, _data/fleet.yml jev: / budget.jev reader, the gh and git wrappers (no hooks, no fsmonitor; git_bytes for a blob's exact bytes), the guards they apply (no merge, no --admin, no destructive or settings verb, allowlists of the gh commands and the git subcommands, options and -c keys JEV uses, no gh api but a GET or an inline GraphQL query, no force-push, mirror or remote delete), the shared owner/repo and bare-file-name checks, the subprocess helper (merged or replaced environment) and the named-keys .env reader |
required |
classify.py |
file | The deterministic classifier: conflicted file → kind, and (files, hunks, lines, history) → one tier | required |
number.py |
file | The assign-at-merge compiler: fragments → features/features.yml, PRD.md, CHANGELOG.md, docs/amendments/NNNN-*.md; plus the hand-picked-number lint |
required |
ratify.py |
file | Ratification, acceptance and completion records: from one commit's state, plan the Status / Ratified by / Accepted in / Completed lines and index cells a maintainer's merge (or a closed tracking epic) decided, with each trigger's evidence; apply that plan byte-exact, prove a diff is exactly it (check-diff), pick the job's own record PR (select), decide whether the job may merge it (guard: go, not yet, refuse, re-cut, stop), and write the record PR's body. GitHub GETs only |
required |
conflicts.py |
file | Detect, trial-merge, triage, resolve by tier, validate, push a merge commit, escalate | required |
ledger.py |
file | _data/jev_resolutions.yml — append-only cost records and the monthly cap arithmetic |
required |
sprints.py |
file | Expedite sprints' ceiling and circuit breaker (constitution § 27): load _data/fleet.yml budget.sprints and refuse what bounds nothing (.inf/.nan/0/negative, above the fleet's monthly ceiling) and overlapping time boxes (WIP 1); a sprint's spend from the AI ledger's loop rows, JEV's ledger and its repositories' own CI runs; the sprint-scope switch (vars.EXPEDITE_SPRINT_ENABLED); gate() → budget-skip / sprint-off and the stop event, asked by the loop runner, the conflict engine and the issue pipeline |
required |
merge-regen.sh |
file | The jev-regen git merge driver: keep ours, record the path for regeneration |
required |
generated.py |
file | Main-only generated files: list them, guard pull requests against editing them, regenerate them on main | required |
headless.py |
file | The local loop runner's headless Claude Code layer: the § 13.8 isolation flags, the --settings sandbox document, the agent environment built from scratch, the CLAUDE_AUTH_ORDER credential choice, redaction, the SIGINT-first streaming runner, the outcome classifier, the $0 probes, the per-run posture checks and the canary's judge (imported by dash-gen ai-run, never the reverse) |
required |
spec.py |
file | Loop step specs: load and validate a steps/<loop>/<step>.yml and its optional local: block, resolve its _data/fleet.yml references (exact model ids only), render its prompt and argv templates in one pass, and hold it equal to its workflow, the kill switch included (steps check, steps render) |
required |
loop.py |
file | The local loop runner, python3 -m tools.jev loop (list, doctor [--live], plan, run, publish, show, budget): gates, the host checks, the budget.loops ceiling, the plan, tier 0, classify, the workspace, the attempt through dash-gen ai-run, the per-run posture checks, harvest and validation, the dry-run preview, the --apply gate and the filing, the canary, the per-item context pack (built on the host, placed beside the brief; --context, --refresh-context, the loop plan preview and the loop doctor planes section), and the run record under .fleet/runs/ |
required |
workspace.py |
file | The runner's throwaway workspaces: a hardened clone outside the hub under ~/.cache/jev/work, an engine-held pristine GIT_DIR that every engine git call on the clone uses, a tamper baseline over .git and any nested .git, a placement that writes only new files under real directories (O_EXCL, no link followed), a no-follow, regular-file-only harvest, and a destroy that never chmods through a symlink |
required |
context.py |
file | The loop runner's context pack, engine half: this loop's earlier attempts on the item (attempts.jsonl, validate.json), the planes' fleet-context/v1 document through ctx.dash_gen(['context', …]) (a subprocess, never an import), the markdown render (data inside fences no row can close, a size cap trimmed lowest priority first), redaction, the 0600 context.md / context.json in the item's run directory, the brief pointer paragraph and the status line; modes auto, off, require (tested by tools/test_jev_context.py) |
required |
surface.py |
file | The harness surface (capability three): Harness²'s eight components mapped onto a Claude Code harness, read as one tree and validated (the always-on cap, skill and subagent frontmatter, the hooks shape, every named script exists, MCP, injection phrasing), the census, the diff and the diversity of candidate trees; refine surface check, census and diff |
required |
library.py |
file | The experience library (capability three): _data/harness_library/<loop>/<domain>/<entry>/experience.yml (jev-experience/v1) + harness.diff, the entry schema and field caps, the leak check through the context pack's redaction, the registry domain of an item, check_all; refine library … |
required |
refine.py |
file | Recursive harness refinement (capability three, ADR 0004): the Propose–Probe–Compose schedule in both modes and the R = 4k / P = 3k ledger identity, the harness_refinement: config, the one-pass mission render, refine plan (the ceiling against budget.loops), refine evidence (the redacted tree a proposer reads, from .fleet/runs), and the refine CLI group |
required |
reflect.py |
file | The incident reflector (capability three, ADR 0004 P1 part one), refine reflect: the evidence tree from the lake's review, the trip wires, the local runs and the library (redacted, $0); ONE capped Read/Glob/Grep session through dash-gen ai-run --isolate inside budget.loops; the engine's validation of every candidate lesson; PREVIEW.md; publish <stamp> --apply (a draft PR from a detached worktree of origin/main, after the token probe and the open-PR dedupe; never under --scheduled); doctor (the $0 probe and the ≤ $0.10 read-fence canary for its posture) |
required |
missions/ |
dir | The five stage prompts of a refinement step and the incident reflector's (data only, adapted from Harness², Apache-2.0); see its SCHEMA | |
adapters/ |
dir | One adapter per loop the runner can run (the contract and REGISTRY); see its SCHEMA |
|
steps/ |
dir | The loop step specs themselves, one directory per loop workflow (data only); see its SCHEMA |
Placement¶
- New JEV capability → a module here plus a
tools/test_jev_<name>.py, a row in this table, and a section indocs/JEV.md. - New loop agent step → a spec pair under
steps/<workflow stem>/(seesteps/SCHEMA.md), never a prompt inline in a workflow. - A loop step that runs locally → its spec's
local:block, plusadapters/<name>.pyregistered inadapters.REGISTRY, plustools/test_jev_adapter_<name>.py. - New refinement stage →
missions/<stage>.prompt.txtplus its row inrefine.MISSION_INPUTS; a lesson →_data/harness_library/throughrefine library add, never by hand.
Forbidden¶
- No ratification-record edit outside the four record files and their status lines (
ratify.ALLOWED_PATH,ratify._shape_problem); the merge of that PR belongs to theratifyjob's YAML step, never to the Python. - No
gh pr merge, no--admin, no repository-settings call, nogh apiwrite, no gh command outside the allowlist (agh pr createonly with--draft) — asserted incommon.assert_no_admin; no force-push, mirror or remote delete, no git subcommand, global option or-ckey outside the allowlist (agit worktreeonly asadd --detach <path> <commit>orremove) — asserted incommon.assert_safe_git; both covered bytools/test_jev_conflicts.py. - No secret, token or model credential in this directory; the
claudeCLI reads its own environment. - No import of dash-gen (
.github/scripts/dash-gen/) from any module here; dash-gen importstools.jevlazily, never the reverse. - No GitHub credential in a local loop-step agent's environment, and no loop-step
claude -poutsideheadless.claude_flagsandheadless.agent_env(ADR 0002, P1) — exceptconflicts.claude_argv(tiers 1–2), not yet isolated and switched off byjev.auto_tiers: [tier0]; it moves onto headless.py before tier1 or tier2 is enabled. - No
--dangerously-skip-permissions,bypassPermissionsor--barein an agent argv. - No publish without the § 13.6 gate, no unattended (
--scheduled) local filing, and no sandbox-posture attempt without a passing isolation probe and canary for the installed CLI. - No workspace inside the hub tree, and no run record outside the gitignored
.fleet/runs/(a refinement's evidence tree outside.fleet/refine/). - No refinement that edits a step spec's prompt, grant or caps (§ 12.3): a hard-rule change is a proposal a person reviews; no model call from
refine.py, and fromreflect.pyonly throughdash-gen ai-run --isolatewith a Read/Glob/Grep grant, a passing probe and read-fence canary,harness_refinement.enabledand thebudget.loopslock; no reflector filing under--scheduled.