Ctx kb site review

From ActiveMemory/ctx · View interactive version

Ctx kb site review is an AI agent skill from the GitHub repository ActiveMemory/ctx. Mechanical structural audit of the kb. Coerces malformed capitalization, flags malformed closeout frontmatter, and refuses to make judgment calls that require evidence. Writes a site-review closeout for the audit trail.

How to use this skill

Skill file

Site-Review Pass

Walk .context/kb/ and .context/ingest/closeouts/ mechanically.

Fix what is unambiguous (capitalization drift, missing frontmatter

fields the CLI knows how to coerce). Flag what is not (claims

that read as broken but require evidence to fix). Never invent

prose. Never mint EV-### rows. Never modify a claim's

Confidence band.

This is a janitor pass, not an editorial pass. Editorial judgment

lives in /ctx-kb-ingest.

Authoritative background reading:

.context/ingest/KB-RULES.md §Authority boundary;

specs/kb-editorial-pipeline.md §Validation Rules.

When to Use

site-review", or invokes the explicit slash form.

matters.

user wants triaged.

When NOT to Use

(use /ctx-kb-ground).

/ctx-kb-note).

Authority Boundary (vs Other Skills)

coerce capitalization that the spec deems lossless (e.g.

Confidence: High → high). May flag any other malformation

in the closeout's What changed block. May not modify a

claim, an EV-### row's content, a Confidence band, a topic

page's prose, or a ledger state. Those require evidence

judgment.

evidence-dependent.

source-staleness.

Usage Examples

/ctx-kb-site-review

No arguments. The pass walks the kb in full.

Pre-Write Gates

Three distinct refusals, each leaves zero residue:

stop.

→ refuse with the scope message and stop.

Process

  1. Verify pre-write gates. Refuse cleanly if any gate fails.

Zero residue on refusal.

  1. Walk topic pages. For every

.context/kb/topics/<slug>/index.md and every sibling

sub-page:

four-field Status block (Subject, Last verified,

Author, Confidence)? Missing fields → flag in

What changed. Do not synthesize.

prohibited per KB-RULES.md. Flag (do not auto-coerce;

human intent matters).

are the only valid values. Coerce capitalization

(High → high, MEDIUM → medium) silently and record

in What changed. Any other malformation (e.g.

Confidence: probable) is flagged for the user.

Confidence floor for any page with TBD-cite is

speculative. If the page's Confidence is above

speculative while TBD-cite is present, flag (do not

auto-demote; demotion is evidence work).

the page must resolve to a row in

.context/kb/evidence-index.md. Unresolved IDs → flag.

page is more than the lede + Status block AND the kb has

plausibly adjacent topics, the section should be present.

Absence is a soft flag (not auto-fixable).

  1. Walk evidence-index.md.

both files / line numbers. The LLM cleanup pass (per

spec's P1) handles renumbering, not this skill.

(do not auto-coerce; renumbering cascades to citations on

topic pages, which is ingest work).

row for the cited source has a dated: field but the

evidence row lacks occurred:, flag. The temporal-

precedence rule needs it.

  1. Walk source-coverage.md.

row's Updated cell against the actual file mtime of the

source it points to (when the source is in-tree). Mismatch

→ flag (lying-to-the-ledger advisory). Do not auto-edit.

does not match an allowed transition from the prior state.

Examples: comprehensive → highlights-extracted without

an explicit superseded step. Do not auto-correct.

columns (Source, Topic, State, EV coverage,

Residue, Next action, Updated). Missing columns →

flag.

  1. Walk closeouts in .context/ingest/closeouts/.

sha, branch, mode, pass-mode, life-stage,

generated-at. Missing fields → flag (the handover-fold

skips malformed closeouts; surface them so the user can

fix or delete).

have a Pass-mode body block whose Declared: value

matches the frontmatter's pass-mode: field. Drift

between the two is exactly the false-finish signal the

redundancy exists to surface. Flag any drift.

topic-page mode must have an Adjacency pre-flight

block whose value is either none surfaced or a

structured slug-list. Free-prose values fail validation;

flag.

topic-page mode must include the four-item rubric in

What changed. Missing → flag.

  1. Walk .context/kb/index.md.

.context/kb/topics/<slug>/index.md currently on disk.

Drift (slug on disk not in the block, or block entry with

no matching folder) → recommend ctx kb reindex in the

closeout's Next pass hint. Do not run the CLI from this

skill.

  1. Write the site-review closeout. Create

.context/ingest/closeouts/<TIMESTAMP>-site-review-closeout.md

with required frontmatter:

```yaml


sha: <short>

branch: <name>

mode: site-review

pass-mode: mechanical

life-stage: <bootstrap|maintenance>

generated-at: <RFC-3339>


```

Body sections:

rows, closeouts walked.

applied (capitalization fixes); cite the file and the

before/after. Empty if zero coercions.

fix. Group by category: malformed Status blocks,

unresolved EV-###, ledger mismatches, malformed

closeouts, etc. Each flag names file + line + nature.

flag category (e.g. *"/ctx-kb-ingest <slug> to restore

missing EV-### citation on <page>"*).

Edge Cases

| Case | Expected behavior |

|------|-------------------|

| .context/ missing | Refuse; suggest ctx init. No residue. |

| .context/kb/ missing | Refuse; suggest ctx init --upgrade. No residue. |

| Kb scope undeclared | Refuse with the scope message. No residue. |

| Zero topic pages on disk | Walk closeouts and ledger anyway. Note the bootstrap state in the closeout. Not a failure mode. |

| Zero closeouts on disk | Walk topic pages and ledger anyway. Note in the closeout body. Not a failure mode. |

| Confidence: High (capitalization drift) | Coerce to high silently; record in What changed. |

| Confidence: probable (unknown band) | Flag for the user; do not coerce. |

| Author: hand-authored | Flag for the user; do not coerce (human intent matters). |

| Duplicate EV-### ID across files | Flag both files; defer renumbering to the LLM cleanup pass per spec's P1. |

| EV-12 (missing zero-pad) | Flag for the user; do not auto-pad (cascades to citations). |

| Unresolved EV-### on a topic page | Flag; recommend /ctx-kb-ingest <slug> in Next pass hint. |

| Ledger row Updated predates source file mtime | Flag (lying-to-the-ledger advisory). Do not auto-edit. |

| Illegal ledger transition (e.g. comprehensive → highlights-extracted without superseded) | Flag; recommend the corrective ingest invocation. Do not auto-correct. |

| Closeout missing pass-mode frontmatter field | Flag; the handover-fold skips malformed closeouts so the user can fix or delete. |

| Closeout body's Pass-mode Declared: disagrees with frontmatter pass-mode: | Flag (false-finish signal); recommend hand-edit. |

| Closeout's Adjacency pre-flight is free prose instead of none surfaced or a slug-list | Flag; recommend hand-edit to structured form. |

| CTX:KB:TOPICS managed block drift | Recommend ctx kb reindex in Next pass hint; do not run the CLI from this skill. |

| TBD-cite on a page with Confidence above speculative | Flag; do not auto-demote (demotion is evidence work for /ctx-kb-ingest). |

| Sibling sub-page exists with no link from index.md | Flag; recommend hand-edit or /ctx-kb-ingest <slug> to extend. |

Anti-Patterns

(Confidence promotion/demotion, claim text edits, EV-###

renumbering, ledger state changes, prose synthesis).

surfaces; never this one's).

intent matters; flag and wait.

citations is ingest work; this skill flags only.

Output Contract

For pre-write refusals, return only the specified refusal text

and stop. No residue.

For passes that clear pre-write gates, end with this structured

summary:

closeouts).

"3 capitalization fixes on Confidence bands").

EV-### citations; 1 ledger mtime mismatch"*).

each flag category (or none if the kb is clean).

Quality Checklist

Before reporting completion, verify:

returned with zero residue).

file + before/after.

nature.

modified, no Confidence band was promoted/demoted, no

ledger state was changed.

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.