Part VII

Harnesses

On this page

Prefer Hooks + CLI for coding harnesses with local shell access. Use MCP for clients that cannot invoke local commands. Keep configuration in version-controlled files rather than copying a site's example into every repository.

The ready-to-use extension and configuration files in Table 7.1 ship in the cns package: in $(brew --prefix)/opt/cns/libexec/harnesses/ on macOS, and in ~/.local/share/cns/cns/<version>/harnesses/ on a Linux server. The links in the table open the same files in the private repository, for reading only. See installation and access.

Setup and access prerequisites

Before installing an integration:

  1. Install the cns package, which brings the organ binaries and the integration files; see installation and access. The beginner lessons do not need the cns wrapper.
  2. Install the chosen coding harness separately. Ensure its command environment can find cns, axon, soma and engram, plus zsh and jq for cns.
  3. Run cns init --domain your-domain from the target Git repository. Review the authored Soma concerns and the generated OTE rather than treating scaffolding as certification.
  4. For remote retrieval, configure an actual THALAMUS_URL or organ-specific endpoints and models. With no relay, init provisions local-only retrieval. Rubric gating is a separate explicit opt-in, not a requirement for local structural checks. What leaves your machine lists what each configured endpoint receives and how to confirm a repository is still local-only.

cns install-harnesses symlinks the packaged Pi extension to ~/.pi/agent/extensions/cns.ts and leaves the installed binaries unchanged. It does not install Pi, configure Claude, Codex or Antigravity, start the relay, or run cns init in target repositories. Inspect the packaged frontier files before copying them: they find cns, axon and engram on PATH (then /opt/homebrew/bin and ~/.local/bin) and run every hook from the repository's Git top level, but their relay addresses are examples, not defaults.

Table 7.1 · Integration sources

Harness Source Role
Pi / pi-durable Pi user guide (repository access may be required) Extension, model routing and OTE setup
Pi extension cns-extension.ts (repository access may be required) Lifecycle integration
Claude Code claude-settings.json (repository access may be required) Hook configuration
Codex CLI codex-hooks.json (repository access may be required) Hook configuration and closeout gate
Codex CLI codex-config.toml (repository access may be required) MCP configuration
Google Antigravity (agy CLI, IDE, 2.0) agy-hooks.json (repository access may be required) Lifecycle hooks and closeout gate; copy to .agents/hooks.json
Google Antigravity (no shell) agy-mcp-config.json (repository access may be required) MCP client integration
Frontier harnesses Frontier guide (repository access may be required) Setup rationale and examples

Listing 7.1 · Minimal Claude Code edit hook

This single-hook example follows the checked-in Claude PostToolUse configuration. Claude keeps a cd across Bash calls, so the command first returns to the project's Git top level; otherwise an edit after cd src/ would find no .axon/axon.db and skip the refresh. Merge the hooks entry into your existing Claude settings; do not overwrite unrelated settings. Run the harness from the initialised target repository and ensure its hook environment finds cns, axon and engram on PATH.

{
 "hooks": {
 "PostToolUse": [
 {
 "matcher": "Edit|MultiEdit|Write",
 "hooks": [
 {
 "type": "command",
 "command": "cd \"${CLAUDE_PROJECT_DIR:-.}\" && cd \"$(git rev-parse --show-toplevel 2>/dev/null || pwd)\" && [ -f .axon/axon.db ] && cns hook axon post-tool-use -- axon index >/dev/null 2>&1 || true"
 }
 ]
 }
 ]
 }
}

After a matching edit, the hook refreshes an existing Axon index and records an axon/post-tool-use vitals row. If no index exists, it skips the command; it does not initialise a repository. Inspect cns status for the channel result. This is an index-refresh integration only, not a full memory lifecycle or a gate; the checked-in Claude, Codex and Antigravity assets enforce the gate separately with a Stop hook running cns gate --stop-hook, and the Pi extension does the same when a run settles. The command shape is checked against bin/cns and harnesses/frontier/claude-settings.json; that source check is not a claim that your Claude installation has run it successfully.

Fig. 7.1 · The integration boundary

  1. Orient: read Soma's maps and Engram's memory block.
  2. Edit: incrementally refresh Axon's index through hooks.
  3. Close out: run cns gate, preserving the distinction between failed and not evaluated.
  4. Consolidate: run cns curate to refresh maps and memory.

Erratum 7.1 · Rubric evaluation is opt-in

Older guide or snippet wording can imply that structural checks always invoke System 1, or never support it. Neither describes the current gate. bin/cns and the rubric / gate contract are authoritative: structural by default, live rubric only after explicit opt-in.

Note 7.1 · Hooks do not certify a change

The hook wrapper records vitals and is fail-open for the harness. Its exit status is not a closeout verdict. Use cns status to inspect channel health and cns gate to evaluate the requested oracles.