OctoEvidence.Cli 0.0.2

There is a newer version of this package available.
See the version list below for details.
dotnet tool install --global OctoEvidence.Cli --version 0.0.2
                    
This package contains a .NET tool you can call from the shell/command line.
dotnet new tool-manifest
                    
if you are setting up this repo
dotnet tool install --local OctoEvidence.Cli --version 0.0.2
                    
This package contains a .NET tool you can call from the shell/command line.
#tool dotnet:?package=OctoEvidence.Cli&version=0.0.2
                    
nuke :add-package OctoEvidence.Cli --version 0.0.2
                    

OctoEvidence

Agent-owned component knowledge in OKF v0.2, validated and synchronized through Git.

OctoEvidence is a deterministic CLI and MCP server for AI coding agents. It works with any programming language because it never parses source code and never calls a model. The external agent reads each component and authors its complete OKF bundle; OctoEvidence discovers declared components, supplies the OKF contract, computes citation digests, validates the result, routes future tasks, and reports three-way synchronization state.

The format is the Open Knowledge Format v0.2.

Requirements: .NET 10 SDK or runtime, and Git on PATH.


The core idea in one minute

  1. You create an empty directory named exactly okf/ inside a component. That declaration is the whole setup — OctoEvidence never writes anything inside it.
  2. Your AI agent (Claude Code, Codex, or any MCP client) reads the component's source with its own tools and authors Markdown knowledge into okf/: what the component is, its routes, decisions, schemas, and claims — subject–predicate–object facts pinned to exact source lines with digests computed by OctoEvidence.
  3. Every future session starts by asking OctoEvidence which components matter for the task and reads their knowledge instead of re-exploring the tree.
  4. The bundles are committed like code. OctoEvidence compares your working tree against a shared sync branch and, when teammates shipped newer knowledge, asks the user: pull it or continue with the local version.

A component exists only when its root contains an exact lowercase directory named okf/:

Identity/
  okf/            <- empty declaration created by the user
  src/

After declaration, the external agent owns every file under okf/, including all index.md files. OctoEvidence never generates, updates, merges, or deletes bundle documents. Okf/ and OKF/ are ordinary directories and are not declarations.


A. Install

Install the CLI once for the current user; the same octoevidence command then works from any repository:

dotnet tool install --global OctoEvidence.Cli --version 0.0.2
octoevidence --help

To upgrade later:

dotnet tool update --global OctoEvidence.Cli

Only the executable is global. OKF documents, octoevidence.json, agent instructions, fetch-throttle markers, and MCP registration remain inside or scoped to each project.

If octoevidence is not found after installing, add ~/.dotnet/tools (Windows: %USERPROFILE%\.dotnet\tools) to PATH.

B. Declare components

From the repository root, create the directories yourself or use the explicit command:

octoevidence init --declare Identity --declare Payment --sync-branch origin/main

init does three small things and nothing more:

  • creates only the empty okf/ directories you named;
  • records the shared sync branch in octoevidence.json (detected from the remote when omitted, or the local branch in a repository with no remote);
  • installs a concise operating block for agents into AGENTS.md or CLAUDE.md (whichever exists; AGENTS.md is created otherwise). Re-running init refreshes the block in place.

To declare the repository root itself as one component, create okf/ at the root.

Empty directories cannot be committed by Git, so have the agent author the root index.md and component.md before the declaration is committed.

C. Register the MCP server

From the project directory, register the stdio server in project scope:

claude mcp add --transport stdio --scope project octoevidence -- octoevidence mcp

Other MCP clients should likewise store the registration in the project and launch octoevidence mcp. Pass --directory <repository> only when that project-scoped client does not launch servers from the project root.

D. Ask your agent to fill the knowledge

For every declaration at once:

Fill every reserved okf folder for this project. Use OctoEvidence prepare_okf_fill with
scope="all", follow OKF v0.2 and the no-code profile, use any available database MCP to
document owned schemas, author every index.md, and validate before finishing.

For one component:

Fill the Identity component's okf bundle for the authentication work in this prompt.

The agent workflow is:

  1. check_component_updates. When the branch has updates, the user chooses: pull them (pull_okf_updates) or continue with the local version.
  2. list_okf_components or prepare_okf_fill with all or one exact component.
  3. Read index.md and component.md first, then request exact paths from availableDocuments; when required, reconcile immutable remote documents into the working tree.
  4. Inspect source code using the agent's own language-appropriate tools.
  5. Use an available database MCP for live schema metadata when relevant.
  6. Author every concept and index directly through the agent's filesystem tools.
  7. Resolve source ranges with cite_lines; store only path, range, and digest.
  8. Run validate_okf and repair every error.
  9. End every session that changed the component by updating the affected concepts, claims, and log.md, then validating again.

CLI equivalents are available:

octoevidence component prepare all --prompt "Document this project"
octoevidence component prepare Identity --prompt "Document authentication"
octoevidence component validate --fail-on-error

E. What a bundle looks like

<component>/okf/
  index.md          # table of contents; root index may declare okf_version: "0.2"
  component.md      # the routing card: title, description, tags, routing_keywords, claims
  log.md            # newest-first history under ## YYYY-MM-DD headings
  interfaces/       # optional concept folders, organized by meaning
  data/             # database and schema concepts
  decisions/

Every non-reserved .md file is one concept with YAML frontmatter; type is the only always-required field. octoevidence okf guide prints the complete authoring contract — layout, frontmatter, provenance, trust, attestation, claims, database rules, and procedure — and the MCP tool okf_authoring_guide serves the same text.

A cited claim in component.md frontmatter looks like:

claims:
  - subject: Identity API
    predicate: exposes
    object: POST /sessions
    kind: route
    source: src/http/routes.ts
    startLine: 18
    endLine: 21
    digest: <value returned by cite_lines>

cite_lines returns an excerpt only so the agent can confirm the selected range. The excerpt must never be copied into OKF.

F. Validate

octoevidence component validate --fail-on-error

The validator uses a complete YAML parser. It enforces concept frontmatter and type, reserved index/log rules, provenance shapes, actor conventions, lifecycle dates, Attested Computation requirements, database schema coverage, cited-claim path/range/digest integrity, and the no-code profile. YAML keys use exact casing. Stale concepts are surfaced and are not marked ready for agents. Unknown concept types, unknown producer keys, missing optional families, and broken links remain consumable as required by OKF v0.2.

Trust is derived, never authored: absent verified is unverified, non-human verifiers are machine-confirmed, and a valid human:<id> verification event is human-reviewed. Malformed events never elevate trust or approve claims.

G. Use it for everyday coding

Once bundles exist, agents route through them instead of searching the tree:

  • find_components ranks the components that matter for a request and names the files to open first, with the claims that earned each match.
  • read_component reads progressively — the index and routing card by default, exact document paths on demand — from the working tree or an immutable branch snapshot.
  • Claims marked pending were written by a model and nobody has confirmed them: useful, not settled. A claim is a map, not the territory.
octoevidence component find "session refresh tokens"
octoevidence component list
octoevidence doctor

H. Stay in sync with your team

check_component_updates snapshots the configured branch commit and compares complete bundle contents against their merge base and the current working tree:

State Meaning
in-sync Local and branch bundles match.
local-only The branch has no bundle; local is authoritative.
remote-only The branch introduced a component not present locally.
local-ahead Only the working tree changed; local remains authoritative.
remote-ahead Only the branch changed.
diverged Both sides changed; the agent must merge deliberately.

Remote-only, remote-ahead, and diverged components block citation work. Merely reading the branch does not clear the gate; the working-tree files must actually be reconciled. OctoEvidence never silently overwrites or pushes authored knowledge. A missing branch or failed fetch also fails closed: hooks and agents are told synchronization was not verified instead of treating a cached snapshot as current.

The decision belongs to the user: pull or continue. When the branch has updates, check_component_updates asks the user directly through MCP elicitation when the client supports it — applying a "pull" answer at once — and otherwise returns a userDecision payload instructing the host agent to ask. Continuing keeps reading and routing available on the local documents; citation authoring stays blocked until the bundles are reconciled. One answer is remembered per branch revision, so the question is not re-asked until the branch moves again.

Pulling is deterministic transport of agent-authored content, never a merge: pull_okf_updates (or octoevidence component pull) materializes the immutable branch bundles for remote-only and remote-ahead components, refuses diverged components — both sides changed, so the agent must read both with read_component and merge deliberately — and never touches local-only or local-ahead bundles.

octoevidence component check --fail-on-drift
octoevidence component pull            # after the user chose to pull

I. Keep knowledge current

The installed instruction block tells agents to end every session that changed a component by updating the affected concepts, claims, and log.md, then running validate_okf until it reports no errors — validate_okf re-verifies every cited line digest, so knowledge that lags edited code fails loudly instead of silently. To enforce the same rule outside the agent's goodwill, wire the CLI into a pre-commit or agent stop hook:

octoevidence component validate --fail-on-error
octoevidence component check --fail-on-drift

Commit the okf/ bundles and octoevidence.json — they are the knowledge and the agreement about where it lives.


Database schemas

When the host agent has a database MCP, it orchestrates that tool and OctoEvidence together. The agent writes one concept per meaningful database, schema, table, or view beneath data/, using # Schema Markdown tables for columns, types, nullability, keys, relationships, indexes, and descriptions. Validation requires database resources and requires schema tables for table and view concepts. It must not store credentials, connection strings, sample rows, personal data, DDL, or SQL queries.

OctoEvidence cannot directly call sibling MCP servers; the host agent owns that orchestration.

No source code inside OKF

OKF itself permits arbitrary Markdown, but OctoEvidence applies a stricter repository profile:

  • only exact lowercase .md Markdown documents inside okf/;
  • no fenced code, verbatim source, SQL, DDL, configuration, executables, or raw logs;
  • use prose, Markdown tables, links, file-and-line locations, and digests;
  • reference OpenAPI, Protobuf, migrations, computations, executors, and attesters at their real location outside the bundle.

Ordinary Markdown structure is fine: nested lists, list continuations, and tables are prose. Only genuine verbatim blocks — fences, HTML <pre>/<code>, or indented code outside list context — violate the profile.

Local-only repositories

A repository without a remote works out of the box: the detected sync branch is the local branch itself, and no fetch is ever attempted for a branch that is not a remote-tracking ref — including local branches with slashes in their names, such as release/2.0.

Configuration reference — octoevidence.json

Committed at the repository root so the whole team shares one answer:

{
  "schemaVersion": 1,
  "syncBranch": "origin/main",
  "fetchEverySeconds": 300,
  "includeDirectories": ["packages"]
}
Field Meaning
syncBranch Branch every agent compares against. Remote-tracking (origin/main) or local (main, release/2.0).
fetchEverySeconds Seconds between fetches for remote-tracking branches. 0 fetches every check; -1 never fetches. Default 300.
includeDirectories Directory names discovery would normally skip (packages, build, …) that this project keeps components in. Applies to the working tree and branch snapshots alike.

CLI reference

Every command answers in JSON and accepts --directory <repository> (defaults to the current directory).

Command Purpose
octoevidence init [--declare <dir>]... [--sync-branch <branch>] [--no-instructions] Declare components, record the sync branch, install the agent instruction block.
octoevidence doctor [--branch <branch>] Status report: declarations, claims, validation warnings, sync state. Never fetches.
octoevidence component list Declared components and what each one knows.
octoevidence component find "<query>" [--limit N] Rank components for a request.
octoevidence component check [--branch <b>] [--fetch-every N] [--fail-on-drift] Three-way sync state; non-zero exit on drift or failure for hooks and CI.
octoevidence component pull [component] [--branch <b>] Materialize branch bundles for remote-only/remote-ahead components; refuses diverged.
octoevidence component prepare [all\|<component>] [--prompt "<goal>"] Everything an agent needs to fill bundles: targets, gaps, sync state, procedure.
octoevidence component validate [component] [--fail-on-error] OKF v0.2 plus no-code profile validation.
octoevidence component cite <component> <file> [--lines 42-60] Digest for a line range, plus the lines it covers for review.
octoevidence okf guide [section] [--json] The complete authoring contract, or one section.
octoevidence mcp [--branch <b>] [--fetch-every N] Run the stdio MCP server.

MCP tools

Tool Purpose
check_component_updates Three-way synchronization state for every local and remote component; asks the user pull-or-continue when the branch has updates.
pull_okf_updates Materialize immutable branch bundles for remote-only and remote-ahead components after the user chose to pull. Never merges.
list_okf_components Complete uncapped inventory for fill-all work.
prepare_okf_fill Targets and instructions for all or one component, focused by the user prompt.
find_components Ranked routing for ordinary coding work.
read_component Progressive, bounded reads from local or immutable remote state; defaults to the root index and component card.
cite_lines Strict line-range digests; invalid ranges are rejected, never clamped.
validate_okf OKF v0.2 conformance and no-code policy validation.
okf_authoring_guide Self-contained format, trust, provenance, attestation, database, and procedure guidance.

Troubleshooting

BLOCKED: <component> requires reconciliation with the source branch. The branch has newer knowledge. Ask the user: octoevidence component pull (or the pull_okf_updates tool) to take the branch's version, or continue working with reads only. Diverged components must be merged by the agent deliberately.

Branch 'origin/main' does not exist here. The configured sync branch cannot be resolved. Set the real one: octoevidence init --sync-branch <branch> — a local branch name is fine for repositories without a remote.

Could not refresh <branch>: ... The remote is unreachable, so the check fails closed rather than trusting a stale snapshot. Restore connectivity, or set fetchEverySeconds to -1 to work offline against the cached ref deliberately.

content.no-code validation errors. A bundle document contains a fence, HTML code block, or indented verbatim block. Move the artifact outside okf/ and reference its path, or cite the lines instead.

Agent ignores the tools. The instruction block is missing — registration alone is not enough. Run octoevidence init (the setup field of check_component_updates reports this too).

Development

dotnet restore OctoEvidence.slnx
dotnet test OctoEvidence.slnx
dotnet pack src/OctoEvidence.Cli/OctoEvidence.Cli.csproj --configuration Release

The tests exercise real temporary Git repositories and run on Windows and Linux in CI.

Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

This package has no dependencies.

Version Downloads Last Updated
0.0.18 171 8/27/2026
0.0.17 120 8/27/2026
0.0.16 131 8/26/2026
0.0.15 135 8/26/2026
0.0.14 130 8/25/2026
0.0.13 139 8/23/2026
0.0.12 124 8/21/2026
0.0.11 135 8/21/2026
0.0.10 137 8/21/2026
0.0.9 137 8/20/2026
0.0.8 133 8/19/2026
0.0.7 139 8/18/2026
0.0.6 148 8/17/2026
0.0.5 156 8/16/2026
0.0.4 125 8/7/2026
0.0.3 151 8/2/2026
0.0.2 155 8/2/2026
0.0.1 158 7/23/2026