# Keeping this current

Source: https://usecns.dev/maintaining/

Static HTML built with Python, Jinja templates and Markdown. No app server, database, Node build chain or CMS. The visual system follows the supplied November 4 design export: Archivo / IBM Plex Mono, cool grey, square panels, teal references, red errata, and the inverted Thalamus relay.

Fenced code uses build-time Pygments highlighting with a light, high-contrast palette and local generated CSS. Add a language such as `sh`, `json`, `yaml`, `toml`, `javascript` or `rust` after the opening fence; unlabeled and unknown languages remain plain text. Highlighting happens after public-content sanitization and only affects HTML: search and Engram exports retain their pre-highlighting representation. No browser-side syntax library or external highlighting service is needed. Syntax colors are a code-only exception to the page's teal/red accent system.

## Public site, independent repository visibility

The website and its downloadable Engram knowledge bundle are intended to be public. The CNS and organ repositories can remain private; source links may require repository access. Publishing this site does not change repository visibility or make private binaries available. Installation and release distribution remain separate concerns.

The public build consumes curated CNS sources and six explicitly public organ documentation capsules. It never imports private README trees, source code, generated maps or internal evidence logs. Local and pull-request builds use the checked-in capsule baseline without credentials; the trusted publication workflow refreshes only the approved capsule paths. Review edits to these capsules, the registry, contracts, architecture and guides as public content. The optional README snapshot mode below remains a separately reviewed preview, not a publishing input.

## Everyday updates

| What changed? | Edit once here | Automatically updated |
| --- | --- | --- |
| Organ progress, status, glyph, channels or commands | `site/organs.json` | Registry, sidebar, plate, channel census, home organ grid and lifecycle chips |
| Inter-organ wire / storage contract | `docs/CONTRACTS.md` | Contract plates, including schema and DeltaReport tables |
| cns command help | `bin/cns` usage heredoc | All six CLI references |
| Installation, harness guidance or terms | `site/content/*.md` | Corresponding page and search index |
| Beginner learning path and worked examples | `site/content/get-started.md`, `site/content/tutorial-*.md` | Lesson pages, navigation targets, search and Engram plates |
| Daily lifecycle | `site/content/lifecycle.md`; shared figure in `site/templates/lifecycle.html` with stages in `site/build.py` | Dedicated page and homepage figure |
| Architecture | `docs/ARCHITECTURE.md` | Architecture reference |
| Public summary of organ progress | `site/organs.json` | Curated public plate; private README changes are not imported automatically |
| Organ manual or command surface | Each organ's `docs/public/cns/{guide.md,commands.md,sources.json}` after activation; `site/manuals/<organ>/` is the local baseline | Manual, command reference, search and Engram plates |

An organ record includes its evidence basis and review date. Keep those current when changing the verification label. **An upstream commit is not a verification verdict.** Upstream READMEs are displayed as reference material, not used to promote status or overwrite curated summaries. A successful build is not evidence of organ health. Do not put secrets or private operational details in documentation intended for public hosting.

Use `verified`, `early`, `not-yet` or `absent` for the visual status. A new organ needs a unique URL-safe `id` and `plate`, a 5 × 5 `glyph` (five strings of `#` and `.`; see `site/DESIGN.md`), a public manual capsule, and an explicit addition to the synchronization allowlist. The registry, sidebar, organ pages, channels and lifecycle lists then discover it automatically. The home page's organ grid and status readout come from the registry too. Its dot-matrix mark is a fixed drawing of the six named organs; placing a new faculty in it requires updating `site/templates/marks.html`.

## Content ownership and promotion policy

**Generated output is disposable; approved sources are not.** A documentation build reads the sources below and replaces `_site/`. It does not rewrite its inputs. Editing generated HTML or knowledge exports is not a way to preserve a correction: change the owning source instead.

| Layer | Current source of truth | Automation boundary |
| --- | --- | --- |
| Reference facts | `docs/CONTRACTS.md`, `bin/cns` usage help | Render the approved definitions; documentation generation must not edit them |
| Curated judgments and explanations | `site/organs.json`, `site/content/*.md`, `docs/ARCHITECTURE.md`, this guide, editorial text in templates and `site/build.py` | Preserve the authored source; changes require a reviewed source edit |
| Organ manuals and command references | Approved `docs/public/cns/` capsule in each organ; checked-in baseline in `site/manuals/<organ>/` | The separate sync step replaces only the six capsule mirrors, never CNS contracts, registry judgments or other curated explanations |
| Presentation | `site/templates/`, `site/static/`, rendering code in `site/build.py` | Compose approved material into HTML, search and knowledge exports |
| Generated artifacts | `_site/`, including `knowledge/` and `knowledge.zip` | Replace on each build; never treat as editorial authority |
| Future AI suggestions | Separate proposal files on a proposal branch, not current site inputs | Draft only; no direct edits to curated sources, merge or deployment permission |

For future mixed reference/narrative pages, compose separate owned sources through templates. Do not have a model rewrite a whole page while asking it to preserve selected paragraphs. Existing editorial text embedded in templates or the builder remains curated content, not model-owned output; this policy does not require extracting it before the current site can ship.

Automatic AI supplementation is **not implemented**. Before adding it, enforce proposal-only changed paths in CI, require maintainer approval, and restrict generation to inputs explicitly approved for public use. A private source summary is not automatically safe to publish. Each proposal must identify its supporting source paths and revisions, distinguish implemented behavior from plans, and include executable-example results where practical. Reviewers promote accepted text into the owning source through a normal PR; rejected and unreviewed proposals never enter the website, search index or Engram export. A model cannot promote verification status or supply its own approval. Automatic capsule synchronization transports already-approved documentation; it does not author or approve prose.

Preserving prose is not enough if its dependencies change. Each capsule's `sources.json` records its reviewed source revision, selected source paths, command paths and inventory basis. Update it with the documentation when a feature changes. The synchronizer separately records the observed upstream `main` SHA in `publication.json`; the website and `manuals.json` expose that observation without changing the review revision/date. It does not establish that every code change was documented. A code-only push cannot invent new public prose, renew a review date, or establish organ health. Registry `basis`, `reviewed` and verification labels remain separately curated. Upstream-commit-only observations do not churn the Engram manual memories.

## Writing an organ manual

Write for a developer who uses coding agents and knows Git and CLIs, but has never used CNS. The opening should answer **what this organ does, when to use it, and how it differs from its neighbors**. Explain the benefit before the mechanism, and introduce terminology through a concrete task.

* Use plain, specific, measured language and one job per paragraph. Prefer "follow callers" to an unexplained anatomical metaphor.
* Put the everyday workflow first: prerequisites, commands, what the result means, and the next action. Give configuration only when that task needs it.
* Keep consequential warnings beside the operation: data leaving the machine, state changes, access requirements, or an unavailable check. Do not repeat general certification disclaimers throughout the article.
* Give each CLI entry its own page with purpose, syntax, options, examples, results and relevant errors. Group navigation by task; keep aliases and nested paths discoverable without overwhelming the index. Preserve exact command paths, defaults and exits.
* Keep task guides short and separate from command references. Give MCP tools, HTTP APIs and configuration their own reference pages rather than appending them to a command wall.
* Describe capabilities that exist. State an unsupported boundary directly rather than making the reader navigate a roadmap or an internal development record.
* Keep source provenance, implementation file lists, audit counts and review evidence in maintainer metadata—not in the reader's manual, navigation, search excerpts or knowledge entries. An editorial change alone does not renew the reviewed code revision or date.

All six organs use this page structure. The three-file upstream capsule contract stays unchanged: the renderer splits approved headings into pages and rewrites cross-references. CLI headings produce command pages, guide headings produce task pages, and reference tables produce individual MCP-tool and HTTP-operation entries linked to their shared protocol. Editing a section updates its page, search entry and downloadable knowledge entry together. Keep the organ overview and references consistent, and land prose changes in the owning capsule as well as CNS's baseline before publication so refresh preserves them.

### Maintaining the first steps

The three lessons share one disposable repository and record the tool versions used to exercise their examples. Installation is one fully qualified Brew command per organ. Record only versions you actually installed from the packages and ran: rerun the lessons from a fresh directory after a release, and update the recorded versions. Check the named symbols and incoming call, not just Axon's exit status. Confirm that the shadow concern reports the harmless edit with exit 0; after promotion and committed activation, the same edit has passing application tests but Soma exits 1. The changed retry key must fail the application test and fire the active concern; restoring the source must return both checks to green. The path trigger deliberately requests review rather than deciding correctness. Keep access requirements and expected output beside the commands. Normal site tests check links and exports, not these tool executions.

### Maintaining Use Cases

The Use Cases landing page and three outcome guides live in `site/content/use-case*.md`, separate from the slower first-steps lessons. They share a disposable `cns-use-cases` fixture with billing and checkout modules. Execute the shell blocks in order with the installed Axon/Soma packages when changing an example, and update the recorded versions only to versions you ran. Inspect search and both incoming callers, then verify the generated codemap's module counts, selected high-fan-in symbol and checkout dependency. Do not claim the map lists every function: its key-symbol list is selective. Check the harmless edit, deliberate retry regression and repaired state separately; the regression must fail the retry test while checkout passes, and the shadow concern must report without gating both matching edits. Preserve the distinction between generated structural facts and authored product policy. New use cases should lead with a concrete outcome and extend the navigation, search/knowledge classification and discovery test alongside their content. Agent prompts are instructions to try, not measured evidence of model performance.

### Maintaining the on-your-repository track

The landing page and five steps live in `site/content/your-repo*.md`. Unlike the lessons and use cases, they have no fixture: each step asks the reader to run the tools on a repository they already know and compare the result with their own expectation, so the pages never show expected output and never claim a count, timing or token figure. Every operation carries a **What you should notice** paragraph and a **Does not prove** paragraph; keep both when editing. Commands and option names are checked against the organ command references (`site/manuals/*/commands.md`) at their recorded versions, not executed against a third-party repository; when a referenced command, flag or default changes in a capsule, update the step that cites it. Steps 1 and 2 need Axon only, step 3 adds Soma, steps 4 and 5 add Engram with local retrieval; none may introduce a relay, hosted model or `cns` wrapper as a prerequisite. The pages are meant to feel easy, so they reveal only what the current step needs: no flag inventories, budgets, field lists, version numbers, known inconsistencies or network posture, and no mention of Thalamus, concept search or features that are not in the track. Where a reader may need more, link to the reference rather than restating it. The pages also do not discuss what does or does not leave the reader's machine; that belongs to the provider and install references, not to a first run.

### Maintaining the "Where next" tracks

After step 5, `site/content/your-repo-next.md` offers six one-page tracks in `site/content/next-*.md`, chosen by the question a reader has after the first track rather than by organ. Each track continues in the reader's own repository, names the step it starts from, and ends by pointing to at most two other tracks. The same rules apply as above, with these additions per track: `next-wiki` (Engram, Markdown pages) uses heading tags, `seed compile --ring M2`, the front-matter map and `keys.json`; it never mentions compartments, rings by number other than the `--ring` flag, hubs, attestation or seats. `next-team` (Engram sync plus Soma promotion) stays on `sync export`/`sync import`, `tolerance`, `promote` and `check --check`; no hubs, tokens or compartments. `next-enforce` (Engram) is the only place on the adoption path that shows attestation, `complete --guard` and `guard_mode`; it never mentions overrides, receipts, sealing or canaries. `next-index` (Axon) covers `status`, `axon.yaml`, full indexing and LSP enrichment; no packs, overlays or providers. `next-search` (Axon) uses `--embed-provider local` only; its moment has not yet been run against a real repository, so verify it on one before changing its claims. `next-hardware` is the one operator track and the only page in the set that introduces Thalamus; it never mentions affinity, admission, draining, telemetry or tokens. Mentioning an organ a track does not use, or a reveal reserved for another track, is a regression.

### Auditing functional coverage

A command heading count is not a capability audit. At an explicit source revision, enumerate public surfaces from the implementation entry points: CLI parsers and dispatch, HTTP/WebSocket route registration and handlers, MCP catalogs and dispatch, configuration and environment loading, harness events, and any intentionally exposed library APIs. Check implementation and tests for aliases, defaults, validation, outputs, errors, state changes and access boundaries; a route name or schema alone is insufficient.

Retain the surface inventory as maintainer audit evidence, not as a reader-facing report. For each implemented public capability, make its inputs, result and failure behavior usable without repository access. Cover the user workflow as well as the individual operation. Identify feature gates and synthetic-only interfaces beside the relevant operation. Private helpers, internal development records and plans are not missing user documentation.

Keep the guide short and link to detailed reference sections. Compare the observed surface inventory with the documentation independently of `sources.json`, then update that file's command paths, supporting source paths, reviewed revision and date to match the work actually inspected. Retain a record of gaps found, corrections and validation. Capsule validation checks schema and listed headings; the build checks links and publication outputs. Neither automatically discovers undocumented implementation features or proves runtime behavior. A code-only organ update therefore still needs its owning documentation review before its public coverage can be considered current.

## Build and preview

The build and test commands are in [CONTRIBUTING.md (repository access may be required)](https://github.com/ivannovak/cns/blob/main/CONTRIBUTING.md#5-documentation-site).

Build output is `_site/` (ignored). Canonical pages use `/<existing-slug>/`, backed by `<slug>/index.html`; the homepage remains `/`. The builder rewrites local links and shared CSS, JavaScript, asset and search paths for directory pages, including hosting at a project subpath. Existing `.html` URLs remain static meta-refresh redirects with a fallback link on GitHub Pages; JavaScript redirects preserve query strings and fragments. Cloudflare uses the generated `_redirects` 301 rules instead. GitHub Pages does not provide server-side 301s.

`--site-url` defaults to `https://usecns.dev/`. The publisher must pass a different canonical base, including any hosting subpath, for an alternative deployment; it is not inferred from the host. For example:

```
.venv-site/bin/python site/build.py --site-url https://example.github.io/cns/
```

Every build checks local links, fragments and duplicate ids. Search is generated from page bodies and runs entirely in the browser; `/` focuses the search input. Fonts load from Google Fonts, with system fallbacks if unavailable.

### Human and agent discovery

Every non-search page has a general-purpose `<slug>.md` twin (the homepage uses `index.md`), a `<link rel="alternate" type="text/markdown">` and a visible **Read as Markdown** link. **For agents** links lead to discovery guidance: `llms.txt` provides orientation, `sitemap.md` is the complete non-search page index, and `discovery.json` catalogs HTML and Markdown URLs. These reading formats use the same approved sources; they are distinct from the tagged Engram seeds described below. Formats have explicit URLs, not `Accept` content negotiation, and add no runtime or MCP endpoint to GitHub Pages.

Search-engine foundations are canonical URLs, per-page descriptions and social metadata, honest `TechArticle` JSON-LD, `sitemap.xml` and `robots.txt`; search itself is `noindex`. Markdown and agent discovery are optional conveniences, not special SEO requirements. Google does not require `llms.txt`, Markdown or special AI schema for its AI features. These outputs promise neither ranking nor citations and change none of the publication, ownership or access boundaries above.

For a separately reviewed upstream preview, add `--refresh-upstream`. Set `GH_TOKEN` through your environment with **read-only Contents access to all six organ repositories**. This includes private README contents in both the HTML and Engram export: do not publish that output without a public-content review. The builder fetches `main` once per organ, then reads its README at that exact commit. No organ code is checked out or executed. Any fetch failure fails the build rather than publishing an apparently fresh partial snapshot. The normal static builder itself uses only this checkout and needs no token or network; trusted publication runs the separate allowlisted capsule sync first.

## GitHub Pages and automatic publication

1. In this repository's **Settings → Pages → Build and deployment**, choose **GitHub Actions**. No `gh-pages` branch is needed.
2. Once the activation prerequisites below are complete, the `docs-site` workflow checks pull requests offline, and refreshes/builds/publishes on trusted `main` pushes, organ notifications and the daily fallback (09:23 UTC; 03:23 CST / 04:23 CDT). The owner explicitly requested this ongoing automatic-publication behavior; it replaces the former manual-only gate.
3. Trusted refreshes use `CNS_ORGANS_TOKEN` with read-only Contents access to the six organs, exclusively for their public capsules. PRs do not receive that credential or import upstream material. Every public workflow excludes README snapshot mode.
4. Keep the site public and repository visibility unchanged. Confirm the GitHub plan supports Pages from this private source repository; otherwise use Cloudflare Pages with the same curated build command.
5. Manual recovery remains available through **Actions → Run workflow** on `main` with **publish** enabled. A manual non-publishing run is a preview. Missing credentials or any invalid/missing capsule must fail the refresh rather than publish a partial set; the last successful Pages deployment remains available.

The workflow does not run organ code, live inference, mutate source repositories, or automatically mark anything verified. Production runs serialize instead of canceling an in-progress deployment; every refresh reads all six heads so coalesced notifications cannot omit an organ. GitHub may delay scheduled workflows; push notifications are the prompt path. Configure Pages, capsule files, senders and credentials once; later updates require normal source/documentation commits in the organ that changed.

## Activate updates from all six organ repositories

The update event is **every push to `main`**, including merges, in Cortex, Thalamus, Engram, Soma, Axon and Hippocampus. Feature branches and tags are not publication events. The sender sends `organ-main` with the organ id and pushed revision; the receiver validates those fields and fetches the current head independently. Payloads cannot select a repository, file path, branch or shell command.

1. Review the six baseline capsules under `site/manuals/`. Each contains exactly `guide.md`, `commands.md` and `sources.json`. These are public publication inputs, not the organ's entire docs directory. Treat merging changes to `docs/public/cns/` as an intentional public-content promotion.
2. Run `python site/prepare-organ-docs.py --output /tmp/cns-organ-docs` to stage the capsule and sender files locally for all six organs. Install each staged capsule as `docs/public/cns/` and its sender as `.github/workflows/cns-docs.yml` in that organ through normal reviewed changes. The preparation command does not push or install anything remotely.
3. Provision the credentials below through GitHub's secure secret settings or an appropriately permissioned GitHub App. Repository source access does not imply permission to administer Actions secrets; a 403 requires an authorized administrator, not a broader credential embedded in code. Do not paste credential values into an issue, PR or Amp thread.
4. Land the capsules and senders in all six organ `main` branches, then land the CNS receiver. Use a non-sensitive public-doc edit in each organ to verify a real notification, successful refresh/publication, the correct `publication.source_head` in the public `manuals.json`, and the edited text in HTML/search/knowledge exports. Until those runs pass, the cross-repository path is prepared, not live-proven.

| Credential | Installed in | Least required repository access |
| --- | --- | --- |
| `CNS_DOCS_DISPATCH_TOKEN` | Actions secrets in each of the six organs | CNS only, Contents: write for repository dispatch |
| `CNS_ORGANS_TOKEN` | CNS Actions secrets | All six organs, Contents: read for pinned capsule reads |

An ordinary organ `GITHUB_TOKEN` cannot dispatch into CNS or read other private repositories. Fine-grained tokens are the direct implementation. A GitHub App is preferable for short-lived credentials when available; it needs installation on the relevant repositories and token-minting wiring before use. Never reuse a broad personal admin token as a workflow shortcut.

`python site/sync_manuals.py` performs a deliberate network refresh locally when `CNS_ORGANS_TOKEN` has read access. It resolves only `docs/public/cns/{guide.md,commands.md,sources.json}` through the pinned commit's Git trees, rejects symlinks/submodules and non-directory ancestors, and fetches the verified ordinary-file blobs. The Contents API is deliberately not used because it can dereference a symlink into private material. It validates the complete set before replacing local mirrors. Source metadata stays pinned to the reviewed code revision, while a separate content digest and observed upstream head identify what was fetched. No organ code or documentation build scripts are executed. Re-running `python site/build.py` then updates human pages, search and the knowledge bundle together. Local builds without this sync step use the checked-in baseline.

The sender files, capsule installation, credentials and Pages settings must be activated in their owning repositories. Adding them to CNS alone does not activate the other repositories. The daily fallback catches missed notifications; it is a GitHub Actions schedule, not monitoring tied to an Amp thread. Automatic publication does not change private repository visibility or authorize live-activity enrollment.

## Cloudflare Pages alternative

Connect this repository with build command `pip install -r site/requirements.txt && python site/build.py`, output directory `_site`, production branch `main`, and a Python 3.10+ build environment. Add `--site-url https://your-docs.example/` to the builder command when the canonical base differs from `https://usecns.dev/`; include any hosting subpath. Keep README snapshot mode out of this public build. To refresh organ capsules on Cloudflare, explicitly run the same allowlisted `site/sync_manuals.py` with a read-only organ credential before building; the static builder itself does not fetch sources.

For cross-repo refresh on Cloudflare, use a Pages deploy hook in place of the GitHub repository-dispatch sender, and a scheduled trigger for fallback. Keep the hook URL secret. The supplied automation targets GitHub Pages; do not enable both deployment paths accidentally.

## Engram Knowledge Layer

Every build also emits `_site/knowledge/compartments.json`, tagged Markdown plates in four **M2** compartments, a current key inventory, and `_site/knowledge.zip`. This includes the organ guides and command references as well as the existing CNS plates. Engram's individual entries are exported separately so retrieval can select the relevant command rather than an entire manual. The same source edits drive the human site and this Tier 1 export. See the site's [knowledge layer](https://usecns.dev/knowledge/) page (published at `/knowledge/`) for hydration and retirement semantics. Clean human URLs and general-purpose Markdown twins do not rename `/knowledge/*.md`, change stable keys or authority, or expand the hydration manifest.

Knowledge links to bundled plates target `.md` files at page level, with HTML-only anchors removed. Non-bundled references are labeled website-only rather than emitted as broken offline links. Links to source repositories are labeled as potentially access-restricted in both HTML and Markdown; private source access is not a prerequisite for reading the exported contract or guide itself.

To run conformance and hydration against a real Engram executable, set `ENGRAM_BIN` to its absolute path when running the Python tests. This also checks that unchanged hydration creates no duplicate memories and a single edited plate supersedes only its previous memory. Without that variable, the real-Engram test is explicitly skipped.

Cloudflare Pages additionally deploys `functions/knowledge.js` at `POST /knowledge`, implementing only the read-only pull tools `list_knowledge_compartments` and `read_knowledge_page`. It is not a CRDT fact-sync hub. GitHub Pages serves the static bundle only. `KNOWLEDGE_TOKEN` can require a bearer token on the RPC endpoint; it does not protect static pages or bundles. Set access control for the entire site before publishing private content.

**Engram transport versions:** Engram 1.6.2 adds certificate-validated HTTPS hub transport for hydration and conformance ([release (repository access may be required)](https://github.com/ivannovak/engram/releases/tag/v1.6.2)). Earlier clients need the static bundle or a separately operated trusted local HTTP-to-HTTPS proxy. Do not send bearer tokens over public plain HTTP or disable certificate validation. GitHub Pages still has no RPC endpoint; this transport change does not create one, and this repository does not establish that a Cloudflare endpoint is deployed.