Skip to content

Commit 9b0366b

Browse files
cdeustclaude
andcommitted
feat(wiki): port full 42-scope catalogue from agentic-ai for parity
User pointed at ``agentic-ai/packages/memory/src/wiki/scopes.ts`` as the reference: agentic-ai defines 42 canonical project scopes; Cortex had 27. Importing the missing 15 + aligning 3 scope names brings Cortex to parity. # Renamed for parity * ``configuration-reference`` → ``configuration``. * ``migration`` → ``migration-guides``. * ``extending`` → ``plugins-extensions``. Anchor filenames overlap so existing pages keep coverage; only the scope-name string (in dashboards + curation_gaps frontmatter) changes. # Added 15 scopes Diátaxis how-to / tutorial axis: * ``how-to-guides`` — umbrella index of task-oriented recipes. * ``tutorials`` — step-by-step learning paths. * ``integration-guides`` — wiring into IDEs, CI, model APIs, databases, MCP clients, downstream services. * ``examples`` — end-to-end working sample apps / demos. Setup + local-dev: * ``local-development`` — contributor's machine setup, dev server, hot-reload, mocks. Operational telemetry: * ``logging`` — log format, levels, sinks, rotation, structured fields, conventions for new log sites. * ``observability`` — metrics, traces, dashboards, alerts; OpenTelemetry surface; copy-paste log queries. Security: * ``secrets-management`` — API keys, tokens, certs across dev, CI, prod. Rotation + leak procedure. Distinct from access-control (about the secrets themselves, not who can use them). * ``access-control`` — RBAC / ABAC / capability matrix. Contribution + governance: * ``coding-standards`` — mechanical rules (file size, layer boundaries, naming, lint config, type discipline, source-citation requirements). * ``release-process`` — how a human cuts a release (vs ci-cd which is the pipeline). * ``changelog`` — user-facing record per version (Keep a Changelog). * ``roadmap`` — strategic surface: planned / in-progress / deferred with reasons. Inclusive design: * ``accessibility`` — WCAG level, keyboard nav, screen-reader. "Not applicable — no UI" valid for non-UI projects. * ``localization`` — i18n library, source strings, translator workflow. "Not applicable — single-locale project" valid. Total scopes: 27 → 42. cortex coverage drops to 15/42 until the autonomous worker authors the new anchors. Every other project's queue grows by the same delta. # README architecture + agent integration sections refreshed * "Agent Integration" now opens with Cortex's own headless authoring worker — same agent infrastructure the user's team uses, applied to documentation maintenance. Added the autonomous-6h-spawn explanation. * "Architecture" table refreshed: shared/ row added, core count bumped to 175+ (added wiki curation modules), MCP-exposed handler count = 49. New "Wiki curation subsystem (3.17.0)" subsection enumerates every module that implements the autonomous loop with its responsibility. * CORTEX_CONSOLIDATE_TTL_HOURS named in the configuration paragraph. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 03c6887 commit 9b0366b

2 files changed

Lines changed: 367 additions & 49 deletions

File tree

README.md

Lines changed: 29 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -364,44 +364,63 @@ Each page renders with:
364364

365365
## Agent Integration
366366

367-
Cortex works with teams of specialized agents. Each agent has scoped memory (`agent_topic`) while sharing critical decisions across the team — based on Wegner's transactive memory theory (1987): teams store more knowledge than individuals because each member specializes.
367+
Cortex works with teams of specialized agents — and in 3.17.0 it **uses one itself**. The headless authoring worker is a Claude agent that wakes up every six hours and drains the wiki curation queue: it reads page metadata, queries the codebase-intelligence MCP tools to ground each section in real call-graph facts, then invokes `claude -p` (your existing Claude Code credentials, no API key) to author the missing content. The result is autonomous documentation maintained by the same agent infrastructure your team already uses.
368+
369+
Each agent — Cortex's worker included — has scoped memory (`agent_topic`) while sharing critical decisions across the team — based on Wegner's transactive memory theory (1987): teams store more knowledge than individuals because each member specializes.
368370

369371
<p align="center">
370372
<img src="docs/diagram-team-memory.svg" alt="Transactive Memory System" width="80%"/>
371373
</p>
372374

373-
**Specialization** — each agent writes to its own topic. Engineer's debugging notes don't clutter tester's recall.
375+
**Specialization** — each agent writes to its own topic. Engineer's debugging notes don't clutter tester's recall. The headless wiki worker writes to `agent_topic=wiki-curation` so its drafts don't pollute interactive recall.
376+
377+
**Coordination** — decisions auto-protect and propagate. When engineer decides "use Redis over Memcached," every agent sees it at next session start. ADRs the worker drafts at session end (Entry / Mandatory / How / Result / Serves) are part of this propagation: the task-record IS the cross-agent shared memory.
374378

375-
**Coordination**decisions auto-protect and propagate. When engineer decides "use Redis over Memcached," every agent sees it at next session start.
379+
**Directory**entity-based queries span all topics. "What do we know about the reranker?" returns results from engineer, tester, researcher, AND the wiki worker's drafts naming the reranker.
376380

377-
**Directory** — entity-based queries span all topics. "What do we know about the reranker?" returns results from engineer, tester, and researcher.
381+
**Autonomous wiki maintenance.** SessionStart auto-spawns the consolidate hook every six hours. The hook reads `~/.claude/methodology/.last_consolidate`; if older than the TTL, it spawns a detached subprocess that drains the curation-gap queue. No cron, no daemon, no manual invocation — the agent runs because you open Claude Code, and stops when nothing's left to author.
378382

379383
Works with any custom agents. See [zetetic-team-subagents](https://github.com/cdeust/zetetic-team-subagents) for a ready-made team of **27 specialists** — each with scoped memory that doesn't clutter the others.
380384

381385
---
382386

383387
## Architecture
384388

385-
Clean Architecture with strict dependency rules. Inner layers never import outer layers.
389+
Clean Architecture with strict dependency rules. Inner layers never import outer layers. The 3.17.0 release added the autonomous wiki-curation subsystem on top of the existing layers without crossing any boundary.
386390

387391
<p align="center">
388392
<img src="docs/diagram-architecture.svg" alt="Clean Architecture layers" width="80%"/>
389393
</p>
390394

391395
| Layer | What lives here | Count |
392396
|---|---|---|
393-
| **core/** | Neuroscience + retrieval logic | 118 modules |
397+
| **shared/** | Pure utilities (text, hash, similarity, types) | 11 modules |
398+
| **core/** | Neuroscience + retrieval + wiki curation logic | 175+ modules |
394399
| **context_assembly/** | Structured context assembler | 10 modules |
395-
| **infrastructure/** | PostgreSQL, embeddings, file I/O | 33 modules |
396-
| **handlers/** | MCP tools | 62 tools |
397-
| **hooks/** | Lifecycle automation | 7 hooks |
400+
| **infrastructure/** | PostgreSQL, embeddings, file I/O, MCP client | 33 modules |
401+
| **handlers/** | MCP tools + consolidation cycles | 91+ tools / 49 MCP-exposed |
402+
| **hooks/** | Lifecycle automation (incl. autonomous consolidate spawn) | 9 hooks |
403+
| **server/** | HTTP standalone + wiki API + viz | 4 modules |
398404
| **observability/** | Prometheus text-format metrics | 1 module |
399405

406+
**Wiki curation subsystem (3.17.0):**
407+
408+
* `core/wiki_coverage.py` — 42 canonical project scopes, per-domain audit, file-level coverage, anchor freshness window.
409+
* `core/wiki_curation_gaps.py` — 14 canonical file-doc sections, gap detection.
410+
* `core/wiki_drift.py` — drift detection (missing source citations, stale mtime, off-template).
411+
* `core/wiki_stub_detector.py` — placeholder + shallow-content scoring.
412+
* `core/wiki_file_doc_skeleton.py` — generates skeletons with visible gap markers.
413+
* `core/wiki_coverage_dashboard.py` — per-project `wiki/_dashboards/<project>.md` regenerated each cycle.
414+
* `core/auto_task_record.py` + `handlers/auto_task_record_writer.py` — session-end auto-draft of ADRs with Entry/Mandatory/How/Result/Serves.
415+
* `handlers/consolidation/wiki_maintenance.py` — purge + audit + dashboard generation.
416+
* `handlers/consolidation/headless_authoring.py` — drains the gap queue via `claude -p` with codebase-intelligence MCP tools grounding each section.
417+
* `hooks/consolidate_background.py` + `session_start.py` — autonomous 6-hour spawn loop.
418+
400419
**Storage:** PostgreSQL 15+ with pgvector (HNSW) and pg_trgm. All retrieval in PL/pgSQL stored procedures.
401420

402421
**Concurrency (v3.13+):** `psycopg_pool.ConnectionPool` with two latency classes — `interactive_pool` (min=2, max=8) for recall/remember/anchor, `batch_pool` (min=1, max=2) for consolidate/ingest. Tool handlers run on worker threads via `asyncio.to_thread`; per-tool admission semaphores bound fan-out. Heat is a *function* computed at read time by `effective_heat()` — homeostatic writes one scalar per domain per run instead of N rows.
403422

404-
**Configuration:** Set `DATABASE_URL` (default: `postgresql://localhost:5432/cortex`). All parameters use `CORTEX_MEMORY_` prefix — see `mcp_server/infrastructure/memory_config.py` for the full list (~40 parameters).
423+
**Configuration:** Set `DATABASE_URL` (default: `postgresql://localhost:5432/cortex`). All parameters use `CORTEX_MEMORY_` prefix — see `mcp_server/infrastructure/memory_config.py` for the full list (~40 parameters). Wiki cycle TTL is `CORTEX_CONSOLIDATE_TTL_HOURS` (default 6h).
405424

406425
---
407426

0 commit comments

Comments
 (0)