Repository Deep Brain
A local, versioned map of files, symbols, imports, tests, Git evidence, and relationships.
Relay connects customer evidence, prior decisions, and the real codebase. It produces a cited build plan, then helps you check whether the resulting change stayed on product.
Read https://relayevals.com/agents.md and set up Relay 0.10.3 for this repository. Use the exact committed Git root and stop only after `brain status --check` shows READY, fresh, and coverage PASS.Paste this into Claude Code, Codex, Cursor, or Hermes from the repository you want to use. You approve browser sign-in and confirm the exact Git root.
AI coding agents know code. They usually do not know which customer asked, what your team already decided, or where the safe boundary of this change ends.
A local, versioned map of files, symbols, imports, tests, Git evidence, and relationships.
Customer evidence, source references, themes, comments, and hosted planning history.
A cited contract containing the goal, Non-goals, file operations, acceptance criteria, and tests.
A readable report and CI gate that check the declared contract without replacing your normal tests.
Run these commands in a terminal. You need a Git repository with at least one commit. Node 24 LTS is recommended; maintained Node 22, 24, and 26 releases are supported.
Create a safe empty baseline first. This does not stage the project files.
$ git init
$ git commit --allow-empty -m "Initialize repository"This offline check finds unsupported Node versions, SQLite issues, missing parser assets, Git, and search-tool problems.
$ npx --yes relayai-cli@latest doctorA browser opens. Login stores your Relay account token locally and installs the Claude Code skill. It does not initialize a repository.
$ npx --yes relayai-cli@latest loginRelay binds one exact committed repository root. Run the first command, then enter the path it prints.
$ git rev-parse --show-toplevel
$ cd /the/exact/path/printed/aboveThis writes the managed AGENTS.md instructions and creates the first credential-free structural brain.
$ npx --yes relayai-cli@latest init --about "What this product does and who it serves"Continue only when the active generation says READY, the snapshot is fresh, and coverage is PASS.
$ npx --yes relayai-cli@latest brain status --checkUse a ticket, note, transcript, or quoted observation. Signal storage is unmetered; a direct quoted add can also trigger a one-credit lookup.
$ npx --yes relayai-cli@latest add "Enterprise admins need actor-level audit filtering"Describe an outcome, not an implementation. Open PLAN.md and review its evidence, Non-goals, files, acceptance criteria, and unresolved items.
$ npx --yes relayai-cli@latest plan "add actor filtering to the audit log"The brain is READY and fresh, coverage is PASS, and your first PLAN.md cites real evidence and real repository paths. Review the plan before an agent implements it.
The plan is not the finish line. Version 0.10.3 carries the workflow through implementation, verification, and reviewable learning.
Retain what a customer or teammate actually said.
relayai-cli add "customer statement"Turn one desired outcome into a cited build contract.
relayai-cli plan "desired outcome"Resolve contradictions and correct the plan with human direction.
relayai-cli comment plan/<slug> "note"Let your coding agent implement the reviewed PLAN.md.
relayai-cli run -- codex exec "Implement PLAN.md"Run normal tests, then inspect the product report and CI gate.
relayai-cli verify --base origin/mainTurn a confirmed failure into a draft regression check.
relayai-cli learn finding_<id>Supplies evidence, resolves trade-offs, approves scope, and makes business decisions.
Maps evidence, selects context, creates the contract, and reports declared proof.
Implements the reviewed plan, explains deviations, and writes or updates tests.
Prove behavior, security, build health, usability, and whether the change should merge.
A current plan is bound to an exact brain generation, repository snapshot, and context-pack hash. Its factual claims cite customer signal, repository facts, or explicit human direction.
schema_version: "2"
generation_hash: 8f4b…
snapshot_hash: 2a17…
context_pack_hash: b930…
# Filter the audit log by actor
## Why now—evidence
- Compliance cannot use the audit log without this. [signal:sig_9015e031]
## Non-goals—do not build
- Do not add date-range or action-type filters.
## Acceptance criteria
1. Filtering returns only the selected actor's entries. [signal:…, fact:…]
## Implementation steps
1. modify src/app/api/audit/route.ts (expected sha256 …)
2. create src/app/api/audit/route.test.ts (must be absent)Is the outcome stated clearly enough that a customer could recognize it?
Does the plan cite the right customer signal and repository facts?
Is the agent explicitly told what not to build?
Are the named paths real and the create/modify/delete actions sensible?
Can each item be observed or tested?
Are authorization, money, data, migrations, and failure cases handled when relevant?
relayai-cli comment plan/<slug> "…", then review the new plan version.Run your repository's normal tests, build, lint, security checks, and human review. Then use Relay to check the declared product contract.
$ npx --yes relayai-cli@latest verify --base origin/main$ npx --yes relayai-cli@latest gate --base origin/main.scriptonia/config.yaml, declare the evidence your CI produces, and enable gate in CI.verify produces the human-readable report. gate provides enforcement. Default deterministic verification is local and free; optional semantic criteria are explicitly enabled and metered.
It builds an ignore-aware census, detects the stack and manifests, parses supported languages structurally, connects symbols and imports, maps tests, inspects bounded Git evidence, and stores everything in an immutable generation.
| Build choice | Use it when | Hosted model |
|---|---|---|
init or brain build --fast --offline | First setup or a quick structural rebuild | No |
brain build --offline | Refreshing an existing local brain after normal code changes | No |
brain build --deep --offline | Full deterministic mapping without model explanations | No |
brain build --deep | Adding citation-checked architecture, pattern, and decision-candidate knowledge | Yes |
READY means a complete candidate passed brain activation checks.
Fresh means its snapshot still matches the current repository state.
Coverage PASS means required mapping and integrity checks passed.
None of these proves every behavior is correct or the application is production-ready.
Relay is local-first for repository analysis and deterministic verification. It is hosted where cross-project product memory and synthesis are needed.
A normal connected Deep Brain build requests three knowledge documents, so it normally uses 15 credits. Local deterministic brain work and verification are free. Check your live balance with scriptonia credits; see current pricing for plan allowances.
scriptonia decide are used by local verification. Hosted plan decisions and comments are used during hosted planning. They are not automatically synchronized yet, so do not assume recording a rule in one plane makes it active in the other.Initialization writes a reviewable AGENTS.md contract. Claude Code also receives a skill; other agents can read PLAN.md or AGENTS.md, and MCP-native clients can connect over stdio.
Login installs the skill. Init writes the repository contract. Reinstall after an update with:
scriptonia skillAsk the agent to implement the reviewed PLAN.md and respect its Non-goals and unresolved gates.
codex exec "Implement PLAN.md"Use your stored Relay login to expose product context and source-linking tools.
npx --yes relayai-cli@latest mcp$ npx --yes relayai-cli@latest run -- codex exec "Implement PLAN.md exactly"The quickstart above is enough for a first result. Open these groups only when you need a specific operation.
--flag=value form, such as --segment=enterprise or --as="Product owner".Use these when installing, signing in, or checking the active project.
relay doctorOffline runtime and brain diagnosis.
relay loginBrowser sign-in; stores account credentials locally and installs the Claude skill.
relayai-cli init --about="…"Bind the exact committed Git root and build its first brain.
relay statusShow signed-in account, endpoint, and active project.
relay creditsShow plan, balance, and reset date.
relay logoutRemove the stored Relay session.
Use these to build, inspect, and explain repository context.
relayai-cli brain status --checkExhaustively compare the repository with the active generation; read its fresh/stale and coverage results.
relayai-cli brain build --offlineRefresh an existing brain locally.
relayai-cli brain build --deep --offlineRun the full deterministic pipeline without hosted knowledge.
relayai-cli brain build --deepAdd citation-checked connected knowledge.
relayai-cli brain context "<task>"Build a local, freshness-checked context pack for one task.
relayai-cli why <path-or-symbol>Explain impact, tests, decisions, and evals affecting a target.
relay pulseQuick local overview of brain, repo, decisions, evals, and recent runs.
scriptonia recall "<query>"Search local decisions and evals.
Use these for hosted product memory and the plan-review loop.
relayai-cli add <files-or-text>Add customer evidence. Supports files, quoted text, or piped stdin.
scriptonia query "<topic>"Quick product-memory lookup without a full plan.
relayai-cli plan "<outcome>"Create the cited schema-v2 PLAN.md.
relay plansList existing plan slugs and versions.
relayai-cli comment plan/<slug> "…"Record human direction and regenerate a new plan version.
relayai-cli link <signal-id>Retrieve the original text behind a signal reference.
scriptonia contextsList themes synthesized from hosted product signal.
relay syncRefresh local product-memory projections and managed instructions.
Use these after the plan is reviewed.
relayai-cli run -- <agent-command>Capture the exact agent command and local run evidence.
relay runsList captured local agent runs.
relayai-cli verify --base origin/mainProduce the complete human-readable local evidence report.
scriptonia gate --base origin/mainAggregate evidence into a machine-enforceable CI status.
relayai-cli learn finding_<id>Convert a confirmed finding into a reviewable draft eval.
scriptonia eval doctorValidate versioned regression-case definitions.
scriptonia eval runRun active regression cases.
scriptonia decide "<title>"Create a reviewable local product or architecture decision.
Use these when wiring compatible coding tools.
scriptonia skillReinstall the Claude Code skill.
scriptonia mcpRun the hosted product-memory MCP server over stdio.
scriptonia --helpPrint the installed command overview.
Initialize every repository separately. Repository analysis lives inside that repository's .scriptonia/brain.db; the home-directory project folder is the local surface for hosted product-memory receipts and projections.
$ cd ~/code/product-a && npx --yes relayai-cli@latest init
$ cd ~/code/product-b && npx --yes relayai-cli@latest init
$ cd ~/code/product-a && npx --yes relayai-cli@latest brain status --checkRelay rejects mismatched parent, child, or sibling roots instead of silently selecting another repository's brain.
These fixes preserve the last known-good brain and avoid destructive recovery steps.
What it means: The npm tag or cached package is older than the stable release.
$ npx --yes relayai-cli@latest --versionThen: The expected stable version for this guide is 0.10.3. Use @latest, not @next.
What it means: The current directory does not match the exact Git root that was initialized.
$ git rev-parse --show-toplevel
$ cd /the/exact/path/printed/aboveThen: Do not force-initialize a parent, nested child, or sibling to bypass the guard.
What it means: No active generation matches the current repository snapshot.
$ npx --yes relayai-cli@latest brain build --offline
$ npx --yes relayai-cli@latest brain status --checkThen: For a first structural rebuild, use --fast --offline.
What it means: The enrichment candidate failed; the last READY generation is preserved.
$ npx --yes relayai-cli@latest brain status --check
$ npx --yes relayai-cli@latest brain build --deep --offlineThen: Do not delete .scriptonia/brain.db. Retry the connected build once if needed.
What it means: The service rejected invalid structured output. It is not proof that your repository is broken.
$ npx --yes relayai-cli@latest --versionThen: Retry the same plan once. If it repeats, send support the request ID and full error.
What it means: Required proof is missing or has not been configured.
$ npx --yes relayai-cli@latest verify --base origin/main --refreshThen: Run your normal checks, expose their declared evidence, confirm the Git base, and verify again.
What it means: The installed native module may no longer match the Node runtime.
$ npx --yes relayai-cli@latest doctorThen: Follow the exact reinstall or rebuild remedy that doctor prints. Deleting the brain will not repair Node.
You do not need to write code to add customer evidence, generate a plan, or review scope. A coding agent or developer implements the plan. An engineer should still configure tests and the CI gate.
No. Claude Code, Codex, Cursor, Hermes, another coding agent, or your developers write the code. Relay supplies grounded context, a build contract, and verification evidence.
No. READY means one repository brain generation passed its activation checks. It does not prove that the application is secure, correct, or ready to deploy.
No. Run the repository's normal tests, build, lint, security checks, and human review. Relay verifies the declared product contract and consumes evidence you configure; it does not automatically execute repository commands.
Brain building, context selection, and deterministic verification have offline paths. Adding hosted product signal, searching it, and generating or commenting on hosted plans still require login and internet access.
You can, but a later regeneration can overwrite the edit. Use a plan comment when the change should be retained as human direction and included in the next plan version.