feat: Фаза 7 шаги 7-10 — job-lifecycle FSM + project passport + parity-smoke
- chezmoi/dot_agents/job-lifecycle.yaml: FSM 13 состояний (Draft→Archived + Failed→Retry), invariants (retry-once, delivered/archived gates), ledger_fields. - claude-starter/project.yaml: шаблон project passport (data_policy, capabilities, agents.preferred_pair, steward.max_proposals_per_week). - claude-starter/routing-evals.example.jsonl: формат eval-записей (3 примера: code-edit/arch/legal с полями ts/job_id/task_class/primary/reviewer/outcome/correction). - athena-router.md: добавлен start matrix 10 классов + eval feedback loop. - smoke/parity-smoke.sh: synthetic parity-smoke — сравнение schema route-card Claude vs Codex + drift-check ~/.claude↔~/.codex если оба развёрнуты. - smoke/agent-contract.sh: +5 проверок (job-lifecycle/project.yaml/routing-evals/ start-matrix/parity-smoke). - smoke/smoke.sh: секция [parity]. - shellcheck -S warning: 0 warnings · smoke: SMOKE OK.
This commit is contained in:
@@ -0,0 +1,79 @@
|
||||
# AthenaOS — Job lifecycle FSM (Phase 7, Local Agent Contract)
|
||||
# Declarative state machine; no runtime engine required.
|
||||
# The ledger records current_state; agents read it and enforce transitions.
|
||||
# Validated by smoke/agent-contract.sh.
|
||||
|
||||
version: 1
|
||||
|
||||
initial_state: Draft
|
||||
|
||||
states:
|
||||
Draft:
|
||||
description: Job envelope created, inputs not yet validated.
|
||||
transitions: [Staging, Failed]
|
||||
Staging:
|
||||
description: athena-guard running input census (sha256 + secret scan).
|
||||
transitions: [ProjectDetection, Failed]
|
||||
ProjectDetection:
|
||||
description: Project identity resolved; data_policy loaded from project.yaml.
|
||||
transitions: [RouteProposed, Failed]
|
||||
RouteProposed:
|
||||
description: athena-router emitted route card; awaiting human approval.
|
||||
transitions: [Approved, Failed]
|
||||
Approved:
|
||||
description: Route approved (human or auto-policy); ready to queue.
|
||||
transitions: [Queued]
|
||||
Queued:
|
||||
description: Waiting for execution slot.
|
||||
transitions: [Running]
|
||||
Running:
|
||||
description: athena-runner executing on primary provider (local-first).
|
||||
transitions: [NeedsInput, ReviewReady, Failed]
|
||||
NeedsInput:
|
||||
description: Execution paused; human response required before continuing.
|
||||
transitions: [Running, Failed]
|
||||
ReviewReady:
|
||||
description: Artifacts produced; athena-reconciler coverage complete; awaiting reviewer.
|
||||
transitions: [Delivered, Failed]
|
||||
Delivered:
|
||||
description: athena-reviewer verdict pass; athena-librarian vault write complete.
|
||||
transitions: [Archived]
|
||||
Archived:
|
||||
description: Terminal. final-learning-tail written; durable in vault.
|
||||
transitions: []
|
||||
Failed:
|
||||
description: Transition failure, execution error, or gate rejection.
|
||||
transitions: [Retry]
|
||||
Retry:
|
||||
description: One rescue attempt via rescue-runner. Second failure → Failed (terminal).
|
||||
transitions: [Running, Failed]
|
||||
|
||||
terminal_states: [Archived, Failed]
|
||||
|
||||
# Invariants — enforced by gates, not just convention.
|
||||
invariants:
|
||||
- id: retry-once
|
||||
rule: Retry is allowed at most once per job_id. A second failure goes to Failed (terminal).
|
||||
- id: review-ready-gate
|
||||
rule: ReviewReady is only reachable after athena-reconciler emits coverage_complete marker.
|
||||
- id: delivered-gate
|
||||
rule: Delivered is only reachable after athena-reviewer emits verdict:pass.
|
||||
- id: archived-gate
|
||||
rule: Archived requires final-learning-tail (brief_md + agent_trace + self_reflection + most_important).
|
||||
- id: no-skip-approval
|
||||
rule: Running is only reachable from Queued; Queued only from Approved. RouteProposed never skips to Running.
|
||||
- id: no-vault-bypass
|
||||
rule: Delivered requires the librarian path; runner may not write to vault directly.
|
||||
|
||||
# Ledger fields written per-job.
|
||||
ledger_fields:
|
||||
- job_id # unique identifier
|
||||
- project_id # from project.yaml
|
||||
- current_state # one of the states above
|
||||
- provider # claude | codex
|
||||
- entered_at # ISO-8601 timestamp of current state entry
|
||||
- history # list of {state, entered_at}
|
||||
- route_card # emitted by athena-router
|
||||
- coverage_marker # emitted by athena-reconciler
|
||||
- reviewer_verdict # emitted by athena-reviewer
|
||||
- tail_written # boolean; set by athena-librarian
|
||||
@@ -8,3 +8,31 @@
|
||||
- **Contract:** emits a route card `{primary, reviewer, capabilities, risk, confidence, why[], alternatives, requires_approval[]}`. No evidence → `confidence: low, status: hypothesis`. Logs every route to `routing-evals.jsonl`.
|
||||
- **Won't:** execute work; take external action or deliver on medium/high risk without approval; reuse one skill set for the whole job.
|
||||
- **Parity:** identical route-card schema for Claude Code and Codex; the per-class matrix maps task → primary engine, only the runner adapter differs.
|
||||
|
||||
## Start matrix (10 classes)
|
||||
|
||||
Default routing hypothesis. Refined by `routing-evals.jsonl` over time.
|
||||
`project.yaml:agents.preferred_pair` overrides per-project.
|
||||
|
||||
| Class | Primary | Reviewer | Why |
|
||||
|---|---|---|---|
|
||||
| code-edit | codex | claude | execution-heavy; Codex optimized for code generation |
|
||||
| debug | codex | claude | trace-first; Codex strong on stack analysis |
|
||||
| arch | claude | codex | synthesis-first; Claude stronger on reasoning + design |
|
||||
| docs | claude | codex | language-first; Claude stronger on writing quality |
|
||||
| legal | claude | codex | reasoning-critical; Claude mandatory for judgment calls |
|
||||
| obsidian | claude | codex | knowledge-graph; Claude for synthesis + linking |
|
||||
| deploy | codex | claude | command-heavy; Codex for shell + CI sequences |
|
||||
| ui | codex | claude | code-gen dominant; Codex for component output |
|
||||
| security | claude | codex | judgment-first; Claude for threat modeling + review |
|
||||
| steward | claude | codex | governance; Claude for weekly improvement loop |
|
||||
|
||||
> Matrix is a hypothesis, not a rule. Correction events in `routing-evals.jsonl` shift weights.
|
||||
> Format: `{ts, job_id, task_class, primary, reviewer, confidence, why[], outcome, correction}`.
|
||||
|
||||
## Eval feedback loop
|
||||
|
||||
Wrong project → apply matching penalty to that project-signal.
|
||||
Always one provider → flag project.yaml `preferred_pair` policy divergence.
|
||||
Bad artifact → label eval record + surface to athena-steward weekly.
|
||||
The loop is closed: every route decision is a falsifiable prediction.
|
||||
|
||||
Reference in New Issue
Block a user