Repository navigation
Context Layer
Canonical source:
context/README.md— this page is rendered from it on every publish; edit the source.
This directory is the stable, human-authored structural map of the ClawAI
monorepo. It sits between the long-form operating policy (CLAUDE.md) and the
machine-generated manifests under .ai/. Where CLAUDE.md tells you how to
behave and the manifests tell you what exists right now, context/ explains
how the system is shaped and why — the parts that change slowly and that an
agent must understand before touching anything.
Every file is focused, cross-linked, and grounded in the generated manifests
(.ai/manifests/*.json) plus the real code. Nothing here is invented: ports,
events, routes, permissions, and services are all derived from ground-truth
sources and should be re-derived when they drift.
| File | Purpose |
|---|---|
| architecture-map.md *** | Canonical. Service topology, request flow, event bus model, data ownership, layering rules. |
| stack-and-toolchain.md *** | Canonical. Exact commands: TypeScript 7 build, the hook-gated landing loop, vitest/playwright, prisma, knowledge/affected/release, docker. |
| codebase-navigation.md | Where to look for any given kind of code. |
| task-router.md | Maps a kind of task → rules + skills + reviewers + validation lane (mirrors .ai/packs/). |
| prompt-pack-intake.md | The seven steps that must precede code when work arrives as a prompt pack or execution prompt. |
| workspace-map.md | The npm-workspace inventory (28 workspaces). |
| service-catalog.md | One entry per service: path, port, DB, responsibility, deps, events, pitfalls. |
| service-dependency-map.md | Who calls whom (HTTP + events + shared packages). |
| frontend-architecture.md | Next.js layering, state, i18n, styling. |
| backend-architecture.md | NestJS layering, module shape, error model. |
| package-boundaries.md | The 6 shared packages and what each owns. |
| declaration-ownership-map.md | Where types/enums/consts/DTOs/events/permissions live; over-extraction guard. |
| request-flow-map.md | End-to-end request paths through nginx → service → DB/events. |
| event-flow-map.md | The RabbitMQ event graph (producers → consumers). |
| database-ownership-map.md | Which service owns which database and models. |
| permission-map.md | The 38 permissions and how they gate features. |
| environment-ownership-map.md | Env-var groups and the mandatory propagation checklist. |
| port-and-service-map.md | The port table + the client-logs/server-logs env-only gap. |
| testing-map.md | Test runners, layout, coverage bar, gate lane. |
| generated-file-map.md | What under .ai/ is generated vs local; never hand-edit. |
| glossary-connector-vs-local.md | Owner vocabulary: "connector" = the cloud connector (OLLAMA_CLOUD), never local Ollama. |
| akinator-station-map.md | Ported Akinator method: station → what it asks → where its output lands in this repo. |
| akinator-always-on.md | Where the always-on Akinator pass triggers (tool by tool), what the in-repo copy contains and what it deliberately does not. |
When two sources disagree, resolve upward in this order. This is the same
hierarchy declared in .ai/BOOTSTRAP.md.
-
CLAUDE.md— long-form operating policy (the north star). -
rules/00-non-negotiable-rules.md— engineering blockers. -
context/architecture-map.md— structural architecture. -
context/stack-and-toolchain.md— commands + toolchain. -
Numbered
rules/*— planning, backend, frontend, testing, infra, docs, commit, security, refactor. -
skills/*— operational runbooks. -
context/*+memory/*— this layer plus durable lessons. -
Generated
.ai/manifests — machine-readable ground truth for facts (ports, events, routes…). -
Compact AI-family routers —
AGENTS.md,CODEX.md,cursor.md.
A fact (a port, an event name, a route) always comes from the manifests. A
rule (how to structure code, what to never do) always comes from CLAUDE.md
and rules/. context/ is the bridge that explains the facts in terms of the
rules.
The knowledge OS uses context/ as a stable reference target, not as a
generated artifact:
- You run
npm run knowledge:context -- --task="<what you are doing>". -
tools/knowledge/context.mjsclassifies the task into one of the.ai/packs/bundles and writes.ai/local/current-context.md(gitignored) with the affected workspaces, governing rules, matching skills, reviewers, related events/permissions/env vars, and pitfalls. - That local context file links into
rules/,skills/, and — through the architecture and service maps — intocontext/. The resolver keeps its output small ("link, don't inline");context/is where those links land.
.ai/BOOTSTRAP.md names context/architecture-map.md and
context/service-catalog.md as the two primary "where things live" targets, so
those two files must stay accurate as the system evolves.
Never write a port, event, route, permission, or service count into these files from memory. Re-derive from:
-
.ai/manifests/services.json,ports.json,rabbitmq-events.json,event-graph.json,permissions.json,nginx-routes.json,frontend-routes.json,docker-services.json,workspace-dependency-graph.json,environment-variables.json. - The real code under
apps/andpackages/.
If a fact here disagrees with a freshly regenerated manifest, the manifest wins and this file is stale — fix it. See generated-file-map.md. | chat-surface-parity-map.md | The ten orchestration surfaces plus judge/critic as surfaces over normal chat: shared code, entry points, exceptions, guards (rule 59) |
ClawAI Wiki · source-controlled under wiki/ · generated/mirrored from the current repository knowledge layer.
ClawAI Wiki
Product
- Product-Vision
- Flagship-Features
- Business-Overview
- Requirements-Register
- Drift-Log
- Runtime-Managed-Connector-Providers
- Threads
- ADR-Index
Architecture
- System-at-a-Glance
- Architecture-Map
- System-Architecture
- Message-Flow
- End-to-End-Data-Flow
- Routing-Engine
- Event-Bus
- Security-Architecture
Platform
- Backend-Services
- Frontend-Architecture
- Shared-Packages
- Database-Reference
- API-Reference
- Provider-Catalog
- Memory-and-Context-Architecture
- File-Support-Architecture
- Research-and-Web-Crawling
Runtime & Ops
- Docker-Guide
- Nginx-Reference
- CI-CD-Pipeline
- Logging-and-Observability
- Operational-Runbooks
- Troubleshooting
Quality
Engineering OS
- AI-Native-Engineering-OS
- Generated-Manifests
- Rules-Catalog
- Skills-Catalog
- Context-Layer
- Engineering-Memory
- Tooling-and-Automation
- Scripts-and-Operations
- ESLint-and-Architecture-Enforcement
- Extended-Work-Skills
Agents
Reference