lean-ctx 3.12.0

LeanCTX Engine: the open-source runtime for the Context Gateway for AI Systems. CLI, MCP server, and supported proxy integrations.
Documentation
{
  "rules": {
    "version": 1,
    "statement": "claim types (fact, decision, gotcha, finding): checks run in this order and the first failing one decides: G2 length 24-300 Unicode scalar values (too_short / too_long), G3 single line (multi_line), G8 list marker (multi_claim), G6 log text (log_text), G4 at most 2 sentences (multi_claim), G5 complete sentence (not_sentence), G7 not truncated (truncated), G9 path share <= 40 % (log_text); reason null = passes",
    "node_type": "explicit node_type wins; archetype decision -> decision, gotcha -> gotcha, workflow -> procedure with steps else fact; then exact category tokens (split on - _ : / space, lowercase): deny {log, trace, debug, output, temp} -> no_type, {decision, adr} -> decision, {gotcha, pitfall, warning} -> gotcha, {procedure, howto, runbook} -> procedure with steps else fact; otherwise fact",
    "refs": "reference grammar of G10; `server: syntax_only` = Hive checks the grammar only (it has no checkout); engines also check the target at HEAD",
    "procedure": "title 8-120 chars, one line, starts like a sentence (final punctuation optional); 1-20 steps of 8-300 chars, single line, no log text, not truncated; 0-10 commands {shell sh|pwsh|cmd, cmd 1-500 chars, cwd_hint <= 120}; failures -> procedure_shape, a bad title -> not_sentence"
  },
  "statement_cases": [
    {"input": "The outbox retries a refused push after the lease is renewed.", "reason": null},
    {"input": "Builds use the shared target, e.g. for worktrees. They never clean it.", "reason": null},
    {"input": "`cargo fast` builds a development binary without LTO.", "reason": null},
    {"input": "3 retries are enough for the relay handshake on slow links.", "reason": null},
    {"input": "Compare A vs. B before merging the release branch.", "reason": null},
    {"input": "Too short.", "reason": "too_short"},
    {"input": "A very long claim A very long claim A very long claim A very long claim A very long claim A very long claim A very long claim A very long claim A very long claim A very long claim A very long claim A very long claim A very long claim A very long claim A very long claim A very long claim A very long claim A very long claim A very long claim A very long claim .", "reason": "too_long"},
    {"input": "The relay drops frames.\nIt also logs them twice.", "reason": "multi_line"},
    {"input": "The relay drops frames. It logs twice. It never retries.", "reason": "multi_claim"},
    {"input": "- The relay drops frames on slow links.", "reason": "multi_claim"},
    {"input": "2) The relay drops frames on slow links.", "reason": "multi_claim"},
    {"input": "the relay drops frames on slow links.", "reason": "not_sentence"},
    {"input": "The relay drops frames on slow links", "reason": "not_sentence"},
    {"input": "Build failed at 2026-10-24T14:02 with code 101.", "reason": "log_text"},
    {"input": "Command ended with [exit:1] after the build.", "reason": "log_text"},
    {"input": "Columns are | a | b | c in the report table.", "reason": "log_text"},
    {"input": "The relay drops frames when the (link is slow.", "reason": "truncated"},
    {"input": "Run `cargo test and then check the output now.", "reason": "truncated"},
    {"input": "See rust/src/core/hive/outbox.rs and rust/src/core/hive/capture/mod.rs.", "reason": "log_text"}
  ],
  "node_type_cases": [
    {"category": "architecture-decision", "node_type": "decision"},
    {"category": "adr", "node_type": "decision"},
    {"category": "pitfall", "node_type": "gotcha"},
    {"category": "rebuild-notes", "node_type": "fact"},
    {"category": "runbook", "node_type": "fact"},
    {"category": "runbook", "steps": 1, "node_type": "procedure"},
    {"category": "build-log", "reason": "no_type"},
    {"category": "debug_output", "reason": "no_type"},
    {"category": "build-log", "explicit": "finding", "node_type": "finding"},
    {"category": "misc", "archetype": "workflow", "steps": 1, "node_type": "procedure"},
    {"category": "misc", "archetype": "workflow", "node_type": "fact"},
    {"category": "misc", "archetype": "gotcha", "node_type": "gotcha"}
  ],
  "ref_cases": [
    {"input": "file:rust/src/lib.rs", "valid": true, "contract_form": "file:rust/src/lib.rs", "server": "syntax_only"},
    {"input": "file:rust/src/lib.rs#L3-9", "valid": true, "contract_form": "file:rust/src/lib.rs#L3-9", "server": "syntax_only"},
    {"input": "file:README.md#L1", "valid": true, "contract_form": "file:README.md#L1", "server": "syntax_only"},
    {"input": "sym:rust/src/core/hive/outbox.rs::Outbox::push", "valid": true, "contract_form": "sym:rust/src/core/hive/outbox.rs::Outbox::push", "server": "syntax_only"},
    {"input": "sym:rust/src/core/hive/outbox.rs#Outbox::push", "valid": true, "contract_form": "sym:rust/src/core/hive/outbox.rs::Outbox::push", "server": "syntax_only"},
    {"input": "test:rust/src/a.rs::tests::name", "valid": true, "contract_form": "test:rust/src/a.rs::tests::name", "server": "syntax_only"},
    {"input": "commit:4a551fc452", "valid": true, "contract_form": "commit:4a551fc452", "server": "syntax_only"},
    {"input": "node:n_abcdefghijklmnopqrstuvwxyz", "valid": true, "contract_form": "node:n_abcdefghijklmnopqrstuvwxyz", "server": "syntax_only"},
    {"input": "https://docs.rs/blake3/latest/blake3/", "valid": true, "contract_form": "https://docs.rs/blake3/latest/blake3/", "server": "syntax_only"},
    {"input": "file:/etc/passwd", "valid": false},
    {"input": "file:../x.rs", "valid": false},
    {"input": "file:a/./b.rs", "valid": false},
    {"input": "file:has space.rs", "valid": false},
    {"input": "file:a.rs#L0", "valid": false},
    {"input": "file:a.rs#L9-3", "valid": false},
    {"input": "sym:a.rs#1bad", "valid": false},
    {"input": "sym:src/lib.rs::", "valid": false},
    {"input": "commit:XYZ1234", "valid": false},
    {"input": "commit:abc", "valid": false},
    {"input": "node:n_short", "valid": false},
    {"input": "http://example.com", "valid": false},
    {"input": "https://127.0.0.1/x", "valid": false},
    {"input": "https://user@example.com/x", "valid": false},
    {"input": "https://localhost/x", "valid": false},
    {"input": "ftp:x", "valid": false},
    {"input": "plain text", "valid": false}
  ],
  "procedure_cases": [
    {"title": "Release the relay", "steps": ["Build the release binary.", "Tag the commit."], "commands": [], "reason": null},
    {"title": "Release the relay", "steps": ["Build the release binary.", "[exit:1] failed"], "commands": [], "reason": "procedure_shape"},
    {"title": "Release the relay", "steps": ["Build the release binary."], "commands": [{"shell": "bash", "cmd": "make"}], "reason": "procedure_shape"},
    {"title": "Release the relay", "steps": [], "commands": [], "reason": "procedure_shape"},
    {"title": "rotate", "steps": ["Build the release binary."], "commands": [], "reason": "not_sentence"}
  ]
}