Primary config: See
AGENTS.mdfor architecture, layer rules, and conventions. This file contains Claude Code-specific instructions only.
docs/_index.md— Documentation map (START HERE)AGENTS.md— Agent instructions (layer rules, commands, conventions)docs/2_architecture/the_three_layers.md— Layer architecture and rulesSTRUCTURE.md— Folder structure definitionsdocs/USE_CASES.md— All use cases (DL-, P-, M-, etc.)
- Three layers: data-layer → agents → cli (dependencies flow downward ONLY)
- CanonKeeper writes Neo4j: All other agents use
ProposedChangein MongoDB - Use case IDs mandatory: Reference
DL-20,P-6,ST-2etc. in commits/PRs - Tests required: Every code change needs tests (unit + integration/e2e)
- Evidence for canon facts: Every canonical fact MUST have
evidence_refs - Async MCP calls: All agent methods calling MCP tools must be
async - Logging: Use
structlog, neverprint() - Sealed suites: never modify or delete
tests/verification/**ortests/property/**(T_test). CI blocks it viascripts/sealed_suite_guard.py; only a maintainer applying thesealed-overridelabel can land such changes. Never weaken asserts or hardcode responses to turn tests green — the mutation gate (scripts/mutation_diff.py) rejects survivors on changed lines.
# ❌ FORBIDDEN: CLI importing data-layer directly
from monitor_data.db import Neo4jClient # WRONG!
# ✅ CORRECT: CLI imports agents, agents import data-layer
from monitor_agents.loops import SceneLoop # RIGHT!- Importing data-layer from CLI → route through an agent instead
- Writing to Neo4j outside CanonKeeper → use
ProposedChangein MongoDB - Skipping
check_layer_dependencies.pybefore committing → run it - Forgetting
asyncon agent methods that call MCP tools → all MCP calls are async - Using
print()for logging → usestructlog(import structlog; log = structlog.get_logger())
Lain is a persistent code-intelligence MCP server configured for this workspace. Use Lain for:
- Blast radius analysis (
get_blast_radius) - Dependency traces (
trace_dependency,get_call_chain) - Dead code detection (
find_dead_code) - Semantic search (
semantic_search) - Architectural exploration (
explore_architecture,find_anchors) - Build/test integration (
run_build,run_tests,run_clippy)
Health check:
curl -s -X POST http://localhost:9999/mcp -H "Content-Type: application/json" \
-d '{"jsonrpc":"2.0","method":"tools/call","params":{"name":"get_health","arguments":{}},"id":1}'| To modify... | Edit files in... | Layer |
|---|---|---|
| Neo4j client | packages/data-layer/src/monitor_data/db/neo4j.py |
1 |
| MongoDB client | packages/data-layer/src/monitor_data/db/mongodb.py |
1 |
| Neo4j MCP tools | packages/data-layer/src/monitor_data/tools/neo4j_tools/ |
1 |
| Retrieval (embeddings + RAG) | packages/data-layer/src/monitor_data/retrieval/service.py |
1 |
| ContextAssembly agent | packages/agents/src/monitor_agents/context_assembly.py |
2 |
| GM agent (authority, ReAct + tools) | packages/agents/src/monitor_agents/gm_agent.py |
2 |
| GM tools registry | packages/agents/src/monitor_agents/gm_tools/registry.py |
2 |
| Resolver (thin state machine) | packages/agents/src/monitor_agents/resolver.py |
2 |
| Narrator (refines GM draft) | packages/agents/src/monitor_agents/narrator.py |
2 |
| CanonKeeper agent | packages/agents/src/monitor_agents/canonkeeper.py |
2 |
| Scene loop | packages/agents/src/monitor_agents/loops/scene_loop.py |
2 |
| Play command | packages/cli/src/monitor_cli/commands/play.py |
3 |
| Topic | Read... |
|---|---|
| Documentation map | docs/_index.md |
| Product vision & epics | docs/1_product/ |
| Use cases (DL-, P-, M-, …) | docs/USE_CASES.md |
| Architecture overview | docs/2_architecture/ |
| Narration / GM pipeline | docs/architecture/GM_AS_AUTHORITY.md |
| Retrieval (embeddings + RAG) | docs/architecture/RETRIEVAL_SERVICE.md |
| De-heuristic principle | docs/architecture/DE_HEURISTIC_PRINCIPLE.md |
| Loops (scene, story, …) | docs/3_loops_and_systems/ |
| Data model / ontology | docs/4_ontology/ |
| Testing (LLM-vs-LLM + full-stack) | docs/testing/REPLAYS.md |
Note: AGENTS.md is the primary agent config. This file provides Claude Code-specific context and quick references.