This repository is the reviewed public projection of an internal monorepo, not an ordinary workspace. Every published file is listed in release/public-source.json, and upstream changes arrive through a three-way merge described in docs/source-sync.md. Moving or renaming files therefore has a cost that a normal repository does not have: it shows up as a conflict or an unreviewed new file at the next synchronization. Prefer changing content over changing layout.
packages/— first-party workspace packages.packages/agent-modules/*is a second level of packages, not a package itself.third_party/— vendored upstream packages (pi-mono,sandbox-runtime) with their own licenses. Their test suites are not part of this distribution's verification.release/— machine-read release contracts.extraction.jsonpins the source baseline and package scope,public-source.jsonis the file inventory,dependency-licenses.jsonrecords declared dependency licenses. Build, type-check, test resolution, and source checks all read from here.docs/— human-readable documentation and supporting media.scripts/— build and verification tooling. Shared constants live inscripts/lib/; import them instead of repeating literal paths or lists.test/— repository-level tests andvitest-suites.json, the declaration of every Vitest file this distribution runs.
Do not edit these by hand; regenerate them and commit the result.
| File | Regenerate with | Checked by |
|---|---|---|
release/public-source.json |
node scripts/source-inventory.mjs --write |
pnpm check:source |
tsconfig.standalone.json (the paths block) |
pnpm gen:tsconfig |
pnpm check:tsconfig |
Review added, removed, and renamed files before regenerating the inventory: recording a file does not make it suitable for publication. Content-only edits to existing files do not require inventory regeneration. Keep private review material, verification reports, and temporary artifacts outside the repository; the inventory scans the working tree, including untracked files outside its explicit exclusions.
Use a feature branch and submit a pull request; do not push directly to the default branch. See CONTRIBUTING.md for contribution and review requirements.
Name new branches by the purpose of the change: feat/<short-description> for features, fix/<short-description> for bug fixes, and corresponding prefixes such as docs/, refactor/, test/, or chore/ for other work. Use concise English descriptions in lowercase kebab-case, for example feat/provider-limits or fix/session-restore. Do not use agent or tool names as branch prefixes, including codex/. Follow an explicitly requested branch name when one is provided.
Never merge internal Git history or cherry-pick internal commits into this repository. Follow docs/source-sync.md, keep unreviewed candidates outside the repository, and apply reviewed files individually. Advance release/extraction.json's sourceRevision only after reviewing all differences for the selected source revision.
| Concern | Declared in | Consumed by |
|---|---|---|
| Package scope | release/extraction.json (packageRoots) |
build, type-check paths, Vitest aliases, source check, source sync |
| Package export → source file | each package's exports via scripts/lib/package-exports.mjs |
tsconfig.standalone.json, vitest.oss.config.mjs |
| Vitest files per gate | test/vitest-suites.json |
vitest.oss.config.mjs, scripts/run-vitest-suite.mjs |
| Retired source paths | scripts/lib/retired-sources.mjs |
check:source (must not exist), check:standalone (must not be bundled) |
| Documentation-only classification | scripts/ci-changes.mjs |
source verification, release audit |
| Source archive validation/extraction | scripts/lib/source-archive.mjs |
source export, candidate validation |
Adding a workspace package: add it to pnpm-workspace.yaml and to packageRoots in release/extraction.json, then run pnpm gen:tsconfig and node scripts/source-inventory.mjs --write.
Changing package exports: run pnpm gen:tsconfig after adding or changing an export subpath.
Adding a Vitest file: add its path to the appropriate group in test/vitest-suites.json. Do not hard-code Vitest file paths in package.json scripts or the Vitest config. Repository-level node:test suites remain in their existing gates; add workflow safety and release-tool regressions to test/source-sync.test.mjs.
Adding a verification gate: add a step to scripts/verify.mjs, with platforms when it cannot run everywhere. Do not add steps to the workflow file.
Do not reference internal hosts, generated IDL, or private services; check:source catches known patterns but does not replace publication review. Do not restore paths listed in scripts/lib/retired-sources.mjs or remove supported capabilities to make standalone checks pass. Do not commit account data, sessions, logs, credentials, or real user content; use temporary data directories and synthetic test inputs. Documentation and commit messages are written in English; preserve the required languages of localized product strings and bundled runtime prompts. See CONTRIBUTING.md.
packages/webui is a browser client with its own operating guide. Before changing anything under it,
read packages/webui/AGENTS.md — the layering rules, the gates each kind of change needs, the test
conventions and the fork's branch and issue workflow — and packages/webui/docs/README.md for the
architecture, module map and decision log. Its issue tracker conventions and triage labels are
packages/webui/docs/agents/.
Repository-wide contributor workflows live in .agents/skills/ and are listed in CONTRIBUTING.md.
AOCI maintains a stable, versioned, incrementally updatable repository-level cognition layer so models can reuse their understanding of this system across tasks.
AOCI assigns one independent Entry to every managed file, database table, or other managed object. Symbolic tags and F/R/A/S semantics describe the object's core responsibility, important relationships, external contracts, and non-obvious constraints or design decisions needed to understand or modify the system.
The complete repository index covers frontend, backend, configuration, database structures, and other managed content. When managed content changes, normally only the affected cognition Entries need maintenance; the complete index does not need to be regenerated.
Read the index only through aoci_overview. The on-disk shape of the index assets — root manifests, content volumes, and runtime state — is an implementation detail that varies by AOCI version. Never glob, read, or infer the index from files on disk, and never treat a missing or unreadable asset as evidence that the index is absent; aoci_overview is the only authority on whether a usable index exists.
AOCI provides a high-density view of system architecture, object responsibilities, important relationships, external contracts, and key constraints.
AOCI uses a model-generated, model-read cognition loop.
Header, Entry, and Curation semantics follow only the current machine-issued Plan and live Guide. The Host model independently authors them from the current bound evidence.
Entry semantics must come from the model's understanding of actual evidence. Never derive, prefill, assemble, or rewrite index semantics solely from paths, filenames, extensions, an AST, symbol lists, dependency scans, regular expressions, fixed templates, or rule engines.
For a Fresh Bootstrap, follow only the current machine-issued Plan and live Guide. When they require authoring, the Host model authors Root, Meta, tags, and F/R/A/S, supplies its authoring-run declaration, and binds it to the Plan, Evidence, and complete Candidate. Never ask AOCI to set origin=host_model, manufacture a receipt, or turn a generated framework into semantics. Do not reconstruct the Onboarding progression here. Internal batches are not user decisions; stop only at an existing approval boundary or a real safety, drift, CAS, or Recovery condition.
aoci_rules: obtain the session-level runtime contract for the current AOCI version.aoci_overview: report index, governance, and delivery state.check_only=truereturns compact facts; a complete Overview is an explicit, expensive choice, not a default.aoci_searchandaoci_get_entries: locate the Entries a task actually needs. This is the normal way to consult the index.aoci_maintain: after managed objects reach their final stable state, check whether cognition needs maintenance.aoci_update_entry: submit a complete semantic update batch bound to current evidence and source digests.aoci_report: when the current layout and tool state support it, record follow-up work if evidence is insufficient to generate semantics reliably; do not guess.
For other MCP tools, CLI commands, parameters, and specialized workflows, follow current tool descriptions, Guide, and --help output. This file does not duplicate the full manual.
This managed block defines only repository integration, cognition use, and task-closing principles. aoci_rules carries the current session contract. Live Guide output carries the execution order and stop conditions of the current Plan. Tool Schema, Spec, and Validator carry machine structures and criteria. Prompt, Description, README, and static documentation cannot override those machine facts.
-
At the beginning of every new Agent Run, ask
aoci_overviewwithcheck_only=truefor the repository's index and governance state. That checkpoint is a compact status fact, not an index load, and its answers must not be inferred from the working tree.The index is a searchable asset, not a document to read up front. Start from the task at hand and consult the index for the specific objects it touches.
-
Call
aoci_rulesonce per Run for the current session contract, then answer repository questions by locating the affected Entries withaoci_searchoraoci_get_entriesand reading the source those Entries point to. A complete Whole-Index delivery is a deliberate and expensive step, not a Run precondition: never pull the entire index into context just to work on a task.Keep whatever context you already hold; local uncertainty does not by itself require rereading the system-wide view. Read only the source, tests, configuration, and contracts the current task directly needs, widening that evidence only when a specific missing fact could change the answer or the verification; AOCI never replaces direct source evidence for the objects being changed or the behavior being verified.
A Run that resumes from a known Host context compaction, including a Host-injected compaction summary, must treat prior model cognition as unreliable. The compacted handoff must not retain or summarize the formal Whole-Index or any Overview Header, Entry, Chunk, Challenge, or Attestation body. Recover only what the task needs: read
aoci_rulesif the runtime contract is no longer reliably present, then look up the affected Entries again withaoci_searchoraoci_get_entries. Do not reload the entire index to recover from a compaction.AOCI can report checkpoint and cognition-status facts for
context_compaction, the machinesemantic_thresholdunder the projectcognition_refresh_threshold, or a majorphase_transition. Usecheck_only=truewhen only those compact facts are needed. They advise the Agent but do not decide whether the model needs the system-wide view.When the Agent explicitly calls ordinary
aoci_overview(check_onlyabsent or false), AOCI must deliver the complete requested scope whenever a coherent CognitionSet can be formed. It must not suppress that body because a receipt already exists, a threshold was not reached, or no refresh reason is pending; the one exception is that capacity stop of a pending compaction refresh. Dirty or stale formal cognition is still delivered but is marked unreliable. Pending recovery or an incoherent snapshot fails closed without a mixed body.When an ordinary Overview reports
continuation_required=true, submit its exactnext_cursorautomatically untilcompleted=true. Do not ask the user to continue, begin the business task, or state a partial system conclusion. Request each Chunk in its own tool call; never fetch several in one script or merge their output. Stop the cognition chain on a missing, duplicate, or reordered Chunk, cursor failure, Index change, orchunk_tokenschange. Until Attestation completes, never use Memory, source, Spec,aoci.txt, historical sessions, scope, search, or Entry reads to repair or supplement Whole-Index cognition. A challenge ordinal is the 1-based position in the formal Entry sequence; Header content, comments, blank lines, Section/Overview/Chunk markers, receipts, and Metadata are excluded, and Chunk Receipt ordinals use that same sequence. The Attestation must echo the Challenge's exact currentindex_sha256,entry_sequence_sha256, andentry_count; a prior Index, Entry sequence, count, or Attestation is invalid. After the complete chain, submit the existing model cognition Attestation once. One same-response JSON Schema or field-format error may be corrected once without changing semantic answers; an object, Tag, or F mismatch means failure and uncertain assimilation, with no semantic retry or information bypass. During initial cognition it also blocks Root/Meta, Migration, layout-wide, or other unbound system decisions. During a context-compaction refresh with complete transport, unchanged cognition identity, aligned governance, and no Recovery or third-party conflict, the attempt consumes that refresh generation even when Attestation is partial or failed; continue the existing task without another automatic Overview.system_mastery_percentself-assesses only the system framework—architecture, responsibilities, strong relationships, stable external contracts, and high-entropy safety and maintenance constraints—not complete implementation or runtime knowledge. Keep machine Index coverage separate, and normally give the user only the prescribed single success or failure sentence derived from actual coverage, Challenge, Chunk, token, and mastery results. If the Host truncates a Chunk, request the same cursor once more and check itschunk_sha256; the server returns the identical bytes. Only if it is truncated again, stop and ask the user to setoverview_delivery.chunk_tokensto a smaller valid value and restart; do not change it automatically.Interpret the additive cognition level independently from strict proof fields.
delivery_verifiedmeans the Index was loaded and Host delivery was confirmed while complete cognition verification is still unfinished; describe that state as loaded and delivery-verified, never as no cognition or failure to understand the system.cognition_verifiedrequires a passing Attestation (at least 80 percent of Challenge ordinals fully correct with at most one object identity miss), andcognition_governedadditionally requires governance alignment. A generic complete-read failure sentence is reserved for an actual delivery fault.When an Overview response contains the optional
cognition-state/v2projection, use its dimensions independently. Its Level ends atmodel_cognition_usable;strict_attestation_verified,governance_aligned, andcurrent_system_cognition_reliableare independent states and never participate in that Level. An ordinal, object identity, Tag, or core F mismatch can make strict Attestation fail while model cognition remains usable; do not report that mismatch alone as proof that the model did not understand the system. Onlycurrent_system_cognition_reliable=truepermits an unqualified current complete-system cognition claim. When the projection is absent, keep using the legacy interpretation above.An ordinary read-only audit, analysis, or check, a request not to modify code, or a request not to commit or push does not automatically mean strictly zero writes and does not alter the cognition-validity decision above. Codex Memory and historical Skills may only help recover experience, user preferences, and investigation directions. They cannot replace a current cognition receipt matching the repository root, index digest, AOCI service identity, and cognition scope. Project AGENTS and current AOCI identity take precedence over historical Memory for AOCI state.
Treat a task as strictly zero-write only when the user explicitly prohibits Ledger, metadata,
.aociruntime assets, and every filesystem write. If necessary cognition establishment conflicts with that boundary, report the conflict and ask the user to decide or recommend an isolated copy. Never silently substitute Memory for current repository cognition. -
If the repository has no usable complete index, or has only a minimal skeleton, an incomplete Header, unfinished Entries, or undecided required Curation, obtain
aoci_rulesand enter the current AOCI Guide when a formal complete AOCI index is required. Let Guide choose the next phase from actual repository state and complete the required safety steps.aoci_maintaindoes not replace the index-establishment workflow.Do not reconstruct or hard-code the full-index generation state machine in this file.
-
During a long-running task, the model is responsible for preserving the current cognition receipt and using the refresh gate correctly:
- when the Host reports context compaction or the model knows the system-wide view was lost, re-query the index for the objects the task needs instead of reloading it wholesale; AOCI cannot infer the Host event;
- when entering a genuinely major phase, declare
phase_transition, not a function, test run, or small step; - at a plausible stable checkpoint, use
check_only=trueto obtain the machine semantic count when that fact is useful; - decide whether the current task needs another scoped lookup or a complete Overview; and
- keep the Dirty or Stale reliability state reported by AOCI until maintenance and alignment complete.
-
A purely read-only question, analysis, version check, or task that changes no AOCI-managed object does not require a maintenance-tool call. The AOCI version in use is
cognition_receipt.mcp_service_versionin anyaoci_overviewcheck_only oraoci_maintainresponse; the binary path is thecommandin the project's.mcp.json, and the CLI need not be on PATH. -
When AOCI-managed objects change, call
aoci_maintainonce after they reach the task's final stable state. Do not maintain files individually after each intermediate edit. -
If maintenance returns actual semantic candidates, the Host model must independently author the complete tag and F/R/A/S updates from each candidate's bound object and necessary evidence. Submit the complete candidate set for that current machine-issued batch in one
aoci_update_entrycall while preserving eachsource_sha256,candidate_id, and domain batch identity.max_entrieslimits one request and atomic transaction, not the logical plan, Whole-Index, or Managed Scope. Whenremainingis nonzero, call Maintain again after the successful Apply and continue from the new preimage; never shrink Index coverage or slice a returned batch to satisfy transport limits.When evidence is insufficient and the current layout supports
aoci_report, use it instead of guessing, applying a template, or generating unsupported cognition merely to eliminate follow-up work. -
Obey structured tool states and safety boundaries:
repair_required: repair only the explicitly identified candidates, then resubmit the complete current machine-issued batch;stopped: end that write attempt and inspectfailed_step, error, formal-write evidence, and Recovery. In auto mode, a proven zero-write closure is followed by a fresh Plan; a complete Intent with provable postimage is resumed; a policy-selected Rollback with exact preimage is completed and replanned. Stop the user task only when proof is unavailable, third-party bytes conflict, approval or external action is required, or another real safety boundary applies;- never ignore conflicts, approvals, human decisions, permissions, or safety signals; and
- after alignment, do not repeat maintenance or writes;
refresh_ready_for_overviewis a checkpoint fact, and the Agent decides whether to request an ordinary complete Overview for its next phase.
If any managed object changes after maintenance completes, the previous result is invalid. Complete closing again from the new final stable state.
-
When the user limits only business-file scope and does not explicitly forbid repository-managed assets, AOCI-managed assets may be updated during closing to preserve cognition consistency. Distinguish them from business files in audits and commits.
When the user explicitly forbids changes to the AOCI-managed index assets, AOCI runtime state, metadata, or any additional file, obey that restriction, do not write, and report any remaining inconsistency accurately. Because the asset layout varies by AOCI version, treat every AOCI-managed file and directory as covered by such a prohibition instead of enumerating a fixed file list.
Initialization, complete-index generation, Header generation, Entries generation, database-structure indexing, Curation, human review, and failure recovery must follow only the instructions, commands, and safety stops returned by the current AOCI Guide or tool at the corresponding stage.
Do not preload, guess, or reconstruct these specialized workflows. The relevant Guide, tool descriptions, model Prompt, and CLI help provide platform invocation, request format, batch limits, approval rules, index-format details, and recovery steps as needed.