Imported from hjung3113/lifetimeworkflow (
AGENTS.md). Install upstream withnpx skills add hjung3113/lifetimeworkflow. Copyright stays with the author.
AGENTS.md — Root Rules (nearest-wins)
The rules an agent follows when developing in this repo. Per-package
AGENTS.md(libs/python/AGENTS.md, each instance's own) refine these for a subtree and resolve nearest-wins; every one restates the non-negotiables rather than inheriting them, because runtime merge semantics differ (Codex replaces nestedAGENTS.md; others concat). Prose is advisory — the backstop is the SessionStart injector plus the hooks (contract-guard, polyglot-boundary linter).
A. Non-negotiable rules
Breaking one of these is a defect, not a style choice. Each is enforced by a gate.
-
Contract-first.
contracts/is the single source of truth. Code that disagrees with the contract is wrong — fix the code, not the contract. Changing a contract is a deliberate act carrying the golden / contract-drift gate: a schema-hash move without a paired golden update fails CI. -
Polyglot §4.3–4.6 boundary invariants. Cross-language equivalence is checked only after the shared canonicalization core runs — never a raw byte-diff. UTF-8 with BOM stripped, forced LF, InvariantCulture
.decimals, tolerance-aware float compare, deterministic key/row ordering, UTC ISO-8601 timestamps, explicit TSV escape and a null-vs-empty token. Language boundary = process / file / DB only — never in-process object passing (A-model: CLI spawn + exit codes). -
Constitution plane is gated — machines gate, humans ratify. Agents do not write to
contracts/,docs/adr/, ordocs/glossary.md— three members. ADR-0012 clause (d) supersedes ADR-0001 §Decision to the extent thatgolden/**leaves the constitution-plane core. No agent self-blesses a golden baseline or edits an ADR — ADRs are append-only, supersede-don't-edit. Instance goldens still exist and are still human-ratified: the CODEOWNERS/examples/*/golden/route is the ratification path. Enforced at runtime:tools/hooks/contract_guard.pydenies the write unless a human setGOLDEN_APPROVE_HUMAN, and CODEOWNERS gates it again at merge. Never edit the guard, the token check, or a hook to get past a deny — stop and report instead. The glossary is one file, not thedocs/tree; the rest ofdocs/is agent-writable. -
Derived plane is not hand-edited.
.memory/derived/(repo-map, contracts-index) is regenerated bytools/memory_regen; delete + rerun must reproduce it byte-identically. Decisions belong in append-only ADRs, not in.memory/state/. -
Core never depends on an instance. The harness core is domain- and language-neutral; specialization lives only under
examples/<name>/. One-directional, enforced by the GEN-04 guard (tools/harness_lint/tests/test_core_no_example_dep.py). -
Lazy-load context. Do not preload full contract bodies. Use the injected contracts-index / repo-map pointers and open a specific contract only when the task needs it. On a data conflict,
contracts/anddocs/adr/outrank volatile.memory/state/— that decides which artifact wins a contradiction, nothing more.
B. How to work
- Act when you have enough to act — ask only when two readings would change the work.
- Lead with the outcome — what changed, passed, or failed goes in the first sentence.
- Claim only what evidence supports — command output,
file:line, or a commit; unrun is "unrun". - Investigate means report, not repair — present cause and fix, then wait for a go-ahead.
- Verify before handing off — run the gates that cover what you touched; a gate you skipped is a gate that is red until proven otherwise.
- Read the file before changing it, and read the per-package
AGENTS.mdwhen — and only when — you touch that package.
C. Golden-path commands
| Task | Command |
|---|---|
| Run all tests | uv run pytest |
Contract-drift gate (JCS SHA-256 over contracts/**/*.schema.json) |
bash tools/contract_drift/check.sh (or python -m tools.contract_drift.drift) |
| Contract hash baseline/manifest | python -m tools.contract_hash.hash |
| Regenerate derived memory (repo-map / contracts-index) | python -m tools.memory_regen.repo_map · python -m tools.memory_regen.contracts_index |
| Assemble the SessionStart injection payload | python -m tools.memory_regen.inject |
D. Monorepo map
A reusable, contract-first polyglot agent-harness template: a domain-neutral core plus
one-or-more instances under examples/<name>/.
CORE — domain-neutral, stays on clone ───────────────────────────────────────────────
contracts/ Constitution plane. JSON Schema Draft 2020-12 + YAML specs. THE source of truth.
docs/ Diátaxis docs (agent-writable) + docs/adr/ (append-only MADR, GATED)
+ docs/glossary.md (ubiquitous language, GATED).
libs/python/ Language-neutral §4.3–4.6 normalization core. → libs/python/AGENTS.md
libs/ + normalize-spec.md (rule spec) + normalize-fixtures/ (shared (raw,canonical) corpus).
tools/ The engine (Python): contract_hash, contract_drift, harness_config,
harness_lint, memory_regen, bootstrap.
harness/ Runtime-neutral config: project.toml (language/instance slot), agents/, commands/,
skills/, permission-matrix.json. Emitted into .claude/ + .opencode/ — never hand-edit those.
.memory/ state/ committed; derived/ gitignored + auto-regenerated.
INSTANCES — the demoted domain specifics ────────────────────────────────────────────
examples/<instance>/ Own contracts/, golden/, components/, language-side normalize twin, tests.
Reference instance = examples/log-parser/. → examples/log-parser/AGENTS.md
The active language/toolchain set is a DATA slot in harness/project.toml ([instance] +
[[languages]]) — the log-parser instance supplies .NET 10 (parser/converter) and Python/uv
(scheduler/collector). Re-templating = swap the instance and that config. Narrative:
docs/explanation/template-and-instances.md.
Harness-Emitted Runtime Surface
This block is generated by tools.harness_emit from the runtime-neutral harness/ source and projected into both runtime trees (.opencode/ + .claude/). Do not hand-edit — a re-emit overwrites it. Everything OUTSIDE the HARNESS-MANAGED markers is preserved verbatim.
- Agents (
.opencode/agent/·.claude/agents/): code-reviewer, curator, explorer, orchestrator, python-engineer - Commands (
.opencode/command/·.claude/commands/): add-language, adopt, adr, agree, build, checkpoint, component, contract-check, docs-sync, fan-out-synthesize, flow, impact, lint, new-contract-rule, orient, refresh-memory, review, test, verify-work - Skills (
.opencode/skill/·.claude/skills/): brownfield-adoption, context-budget, data-contracts, fan-out-synthesize, harness-author, polyglot-boundary, python-conventions, two-plane-memory - Plugins (
.opencode/plugin/) + rootopencode.json— seetools/harness_emit/emit-manifest.jsonfor the full owned-path set.