framework/memex/skills/audit/SKILL.md
Use when the user asks to audit a memex (long-term knowledge bank for AI agents) for orphans, dead SALP REFs, missing sections, contradictions, or index drift. Runs a deterministic structural check, layers LLM-judgement findings, optionally auto-fixes trivial issues with `--fix`. Do NOT trigger on general code linting.
npx skillsauth add korchasa/flow auditInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Health check for the memex (long-term knowledge bank for AI agents). Runs a deterministic script first, then layers LLM-judgement checks on top.
Invoked when the user wants a memex health check (e.g., "audit my memex", "check the memex for dead links", /audit for audit-only or /audit --fix to apply trivial auto-fixes).
Same protocol as the other memex skills:
--memex <path> flag → use that path.AGENTS.md and pages/.No memex found. Pass --memex <path> or cd into a memex directory.Read <memex-root>/AGENTS.md for the schema.
Run the audit script bundled with this skill:
deno run --allow-read scripts/audit.ts <memex-root>/pages/
(The path is relative to the installed skill directory. The exact location depends on the IDE — pass an absolute path if your IDE does not preserve relative working directory.)
The script parses SALP REFs ([REF:mx-<type>:<slug>]). It reports five issue kinds, one per line:
DEAD_LINK: [REF:mx-*:<target>] in <file> — SALP REF points to a non-existent page.ORPHAN: <file> has no inbound [REF:mx-*:...] — page is not linked from anywhere except itself.MISSING_SECTION: <file> (concept) lacks 'Counter-Arguments and Gaps' — concept page missing the gaps section.INDEX_MISSING: <file> not listed in index.md / INDEX_DEAD: index.md references [REF:mx-*:<slug>] which has no file — drift between filesystem and pages/index.md.MALFORMED_REF: <file>:<line>: <raw> — [REF:...] token that violates the mx-<type>:<slug> grammar (wrong namespace, empty slug, etc.).The script handles structure. The following require reading content:
grep -rln "\[!WARNING\]" <memex-root>/pages/ to find every callout marker. List them — these need human resolution.date older than 6 months. Flag any whose claims are likely outdated (rapidly-changing fields).[REF:mx-<type>:<slug>] at the first natural mention if --fix, else just suggest.index.md and identify domains with only 1–2 pages. Suggest 3–5 questions the memex cannot yet answer well — candidates for ask or further save.--fix)For each issue with a trivial deterministic fix, apply it:
| Issue | Auto-Fix |
|---|---|
| DEAD_LINK | Create stub page at the link target with the closest matching template (default: concept). Stub body: # <Slug as Title> [ANC:mx-concept:<slug>]\n\n_Stub created by audit. Needs content from a source._\n\n## See Also\n- [REF:mx-concept:<page that linked to it>]. |
| MISSING_SECTION | Append empty ## Counter-Arguments and Gaps\n\n_None recorded yet._ to the concept page. |
| INDEX_MISSING | Add the page to index.md under a domain derived from its tags frontmatter. |
| INDEX_DEAD | Remove the dead row from index.md. |
| ORPHAN | NOT auto-fixed — finding a sensible inbound page requires judgement. List it for the user. |
| [!WARNING] contradiction | NOT auto-fixed — surface for human review. |
| Stale-claim suspicion | NOT auto-fixed — surface for human review. |
| Unlinked concept mention | Add [REF:mx-<type>:<slug>] at the first natural mention only when --fix is set AND the target page exists. Otherwise just suggest. |
| MALFORMED_REF | NOT auto-fixed — surface for human review (typically requires choosing the right mx-<type> namespace). |
Write <memex-root>/outputs/reports/YYYY-MM-DD-audit.md (create outputs/reports/ if missing):
# Memex Audit Report — YYYY-MM-DD
**Memex:** <memex-root> | **Issues:** N | **Auto-fixed:** M
## Critical
- DEAD_LINK: ... (auto-fixed: stub created at <path>)
- ...
## Warnings
- ORPHAN: ... — suggest linking from <candidate>
- ...
## Suggestions
- 3–5 questions the memex cannot yet answer:
1. ...
2. ...
## Contradictions
- <file>:<line>: <one-line summary> — needs human resolution
log.md## [YYYY-MM-DD] audit | <total> issues, <fixed> auto-fixed
<one-line summary of the worst class of issue>
Print a compact summary:
outputs/reports/.INDEX_DEAD removes index rows, but the underlying file (if it exists) stays.Read, Glob, Grep, Bash (for the deterministic script and for grep), Edit (for index.md, log.md, and append-only fixes), Write (for stub pages and the audit report).--fix, the audit skill is read-only on the memex except for the report file and log.md.development
Use when the user asks to add TypeScript strict-mode code-style rules to AGENTS.md for a TypeScript project using strict mode. Do NOT trigger for Deno projects (use setup-agent-code-style-deno) or non-strict TS configurations.
development
Use when the user asks to add Deno/TypeScript code-style rules to AGENTS.md, or during initial Deno project setup when code-style guidelines need to be established. Do NOT trigger for non-Deno TypeScript projects (use setup-agent-code-style-strict), or for runtime-agnostic style advice.
testing
Use when the user provides a source (URL, file path, or free text) to save into the project's memex — a long-term knowledge bank for AI agents. Stores the raw source, extracts entities into cross-linked pages, runs a backlink audit, and updates the index and activity log. Do NOT trigger on casual reads; only when the intent is to persist a source into the memex.
development
Use when the user asks a question to be answered from the project's memex (long-term knowledge bank for AI agents) rather than training data or the live web. Reads the index, opens relevant pages, follows one SALP-REF hop, synthesises a cited answer, files it back. Do NOT trigger on source-code or live-session questions.