Plan: Truthful Agent Harness + Resilient Dev Substrate¶
- Spec: spec.md (026-truthful-harness-dev-substrate)
- Approach: single implementation cycle, four independent workstreams, each verifiable in isolation; backend changes are additive to API shapes so the frontend keeps working untouched.
Workstream A — Harness truthfulness (FR-1 … FR-6)¶
agents_runtime/crews/precedent_hunter.py: replace the fabricated result with an empty, degraded, confidence-0.0 output; adddegradedtoPrecedentList; log asdegraded/not-implemented.agents_runtime/crews/legal_analyst.py:IRACOutputgainsdegraded,requires_review,retrieval(additive)._run_legacy→ honest degraded refusal (no mock IRAC)._run_via_claude_code→requires_review=true(authorities ungrounded); offline fallback markeddegraded._run_via_langgraph→ keep ALL citations withverified/resolved_case_id; three-state conclusion (refusal / N unverified / N verified); pass throughretrieval_stats.agents_runtime/graphs/legal_workflow.py:- New
RetrievalStatsmodel; populate from final state ininvoke. _parse_jsonreturns dicts only;_clamp01for confidences;_retrieve/_analyzetolerate malformed shapes (FR-6)._cite_check: zero citations ⇒human_approval_required=true.analysis/urls.py: degraded-aware confidence mean; structured HITL flag; WS bookkeeping via newprovenance.log_event(distinct event type).
Workstream B — Provenance integrity (FR-7)¶
core/provenance.py:log_agent_call→_stable_hash; optionalprompt_id/prompt_versionkwargs;_pick_statehelper sologged_nodehashes the state (first Mapping arg), never the bound instance; addlog_eventfor non-agent events.
Workstream C — Loops (FR-8)¶
agents_runtime/crews/test_synthesizer.py:_PROPOSED_DIRanchored viaPath(__file__).resolve().parents[3]..github/workflows/nightly-tests.yml:AUTONOMY_ENABLED: "True"env on the synthesis step (kill-switch stays default-off everywhere else, §12 I3).
Workstream D — Dev substrate (FR-9 … FR-13)¶
docker-compose.yml: healthchecks (backend/health, frontend wget, ollamaollama list, phoenix stdlib urllib), healthcheck-gateddepends_on,env_file(optional root.env), pinnedollama/ollama:0.12.6+arizephoenix/phoenix:12.9.0(tags verified against the registry),mem_limit+ Neo4j heap/pagecache bounds, restart policies, workerOLLAMA_BASE_URL.docker-compose.debug.yml: worker command parity; frontendNODE_OPTIONS=--inspect+ ports 9229–9231.backend/.dockerignore,frontend/.dockerignore; backend Dockerfile BuildKit pip cache mount + realistic healthcheck start period.Makefile:test-integrationtrapdown→stop <dbs>(stops clobbering a running dev stack)..vscode/: extensions (drop forbidden Continue.dev →unwantedRecommendations, add debugpy + Claude Code, drop bogus Neo4j id), tasks (valid matchers, new single-test/evolve/autonomy/LSAT/demo tasks + prompt inputs), launch (frontend server attach 9230, accurate header), settings (no deprecated arg overrides, no phantom venv interpreter, osx terminal env)..claude/hooks/session-start.sh: portable Docker-daemon probe (macOS has notimeout)..mcp.json+ AGENTS.md § Development Orchestration note; stalebackend/lawgraph/pycache tree removed; CLAUDE.mdtools/drift fixed;docs/data-sources.mdCAP-bulk correction + eCFR/USC/RECAP candidates.
Test strategy¶
- Update:
tests/api/test_analysis.py(honest default path, threshold branch),tests/agents/test_legal_analyst.py(degraded default),tests/agents/graphs/test_legal_workflow.py(refusal requires review, coverage envelope, malformed-shape survival). - New: provenance stable-hash + bound-method state tests,
log_eventtype test,_PROPOSED_DIRanchoring regression test. - Gates:
make test-backend(with DB services up),make lint,make typecheck,make lint-specs,docker compose config --quiet.
Rollback¶
Every change is a normal git revert; no migrations, no data changes. Image pins can be reverted independently of code.