world-model-ledger

Installs a SQLite-backed world model that tracks codebase entities, interactions, and constraints with confidence scores.

1|Updated May 28, 2026
One-click install
npx skills add https://github.com/dhanesh/agent-skills --skill world-model-ledger-dhanesh
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: world-model-ledger
Source: https://github.com/dhanesh/agent-skills/tree/main/world-model-ledger
Command: npx skills add https://github.com/dhanesh/agent-skills --skill world-model-ledger-dhanesh

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) and references (resource) and assets (resource) components.

What problem does it solve? Coding agents forget what they learn about a codebase between sessions, and they cannot distinguish relationships they merely observed in code from ones verified as correct. This Skill installs a persistent SQLite-backed world model that remembers entities, interactions, and constraints across sessions, tracks observed-vs-normative confidence for each fact, and detects contradictions with proposed fixes. ## Core Features & Use Cases - Persistent codebase memory: Records symbols, files, modules, and external referents plus their interactions in a per-project SQLite store, auto-captured by four Claude Code lifecycle hooks with zero manual effort. - Two-axis confidence tracking: Separates observed confidence (we saw this in code) from normative confidence (an oracle like a test, CI run, doc, or human verified it), so observed-but-unverified facts are flagged instead of trusted. - Contradiction detection and fixes: Evaluates constraints each turn, opens contradiction rows with located, human-readable proposed fixes, and converts contradicted mass to validated mass as the code is corrected. - Ontology-guarded writes: Every triple is validated against a closed predicate vocabulary with domain/range rules before insert, rejecting hallucinated verbs and impossible pairings. - Use Case: An agent editing services/report.py is warned before the edit that it imports a deprecated config module, because a prior session recorded that constraint — knowledge not visible in the file itself. ## Quick Start Ask the agent to install the world-model-ledger skill into this project and restart Claude Code so the lifecycle hooks begin capturing codebase knowledge automatically.

Frequently Asked Questions about world-model-ledger

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I give a coding agent persistent memory of a codebase?▼

Run the install script once at project or global scope; it copies the store, CLI, and four lifecycle hooks into your settings.json. The hooks then capture files, executions, and URLs automatically each turn, persisting everything in a per-project SQLite database.

How does the world model distinguish verified facts from observations?▼

It keeps two independent confidence axes: observed confidence rises from code sightings, while normative confidence only rises on oracle evidence such as passing tests, CI, docs, or human confirmation. Facts stay unverified until an oracle backs them.

Does world-model-ledger work with Claude Code hooks?▼

Yes, it requires Claude Code lifecycle hooks: PreToolUse, PostToolUse, Stop, and SessionStart. The installer merges them additively into settings.json, preserving existing hooks, and you restart Claude Code afterward so they load.

Can I use world-model-ledger with context-hygiene-kit?▼

Yes, the settings merges coexist because both installers use the same additive jq merge. However, two project-scoped installs into the same repo clobber each other's files, so install at least one of them globally.

What are the limitations of the automatic capture hooks?▼

Hooks see only tool invocation and exit status, not intra-process behavior, so they record that a script ran but not what it calls internally. They also never harvest tool output, so richer semantic relationships must come from explicit agent markers or the wm CLI.