---
title: "Owned AI agent memory in Markdown: owned-record"
description: "Keep what your agents know in files you control. Store domain context in Markdown and Claude Code and Codex CLI transcripts in SQLite. Read the source."
canonical: "https://scalewithsearch.com/code/owned-record"
date: "2026-10-06"
---
# Owned AI agent memory in Markdown: owned-record.

Keep what your agents know in files you control. Store domain context in Markdown and Claude Code and Codex CLI transcripts in SQLite.

[Source repository](https://github.com/b2bvic/owned-record)

## Team workflow

Retain the original transcripts beside readable exports. Select the records a task needs before sending them to a hosted model. Keep current state in _context.md and activity history in _log.md.

## Quick start

Use Git, Bash, and Python 3.11 or newer. Shell hooks require jq. Real recall requires configured QMD collections.

```sh
git clone https://github.com/b2bvic/owned-record.git
cd owned-record
bash examples/demo.sh
```

The root demo emits a candidate path without loading a context body. Review scripts/setup.sh and the domain map before personalizing the reference.

## How it works

A hosted-model session starts without your business context unless you supply it. Markdown files, source transcripts, SQLite, and JSON exports retain records outside the session. The registered pointer router emits candidate paths with context_loaded: false. Optional hooks can load context, retrieve records, or supply writing samples. Cloning installs no background job and enables no recall.

## Components

Select a component to inspect its purpose, example, and limits:

- [session-ledger](#session-ledger)
- [cc-bridge](#cc-bridge)
- [route-domain](#route-domain)
- [pretool-memory](#pretool-memory)
- [voice-calibration](#voice-calibration)
- [web2md](#web2md)

Start each component example from the cloned repository root. Use a fresh shell for each example.

### session-ledger

You archive local Claude Code and Codex CLI transcripts in SQLite with session-ledger. You retain messages, correlated tools, file operations, parse errors, and provider identities. You can search with FTS5 and export JSON. The example uses empty isolated roots instead of your session history.

```sh
cd components/session-ledger
demo_record=$(mktemp -d)
mkdir -p "$demo_record/claude/projects" "$demo_record/codex/sessions"
export LEDGER_DB="$demo_record/sessions.db"
export LEDGER_CLAUDE="$demo_record/claude"
export LEDGER_CODEX="$demo_record/codex"
unset LEDGER_PROJECT LEDGER_VAULT
python3 ./ledger init
python3 ./ledger harvest --source all
python3 ./ledger search "authentication bug"
python3 ./ledger export --pretty --out "$demo_record/sessions.json"
```

**Limits**

- The archive reads local Claude Code and Codex CLI transcripts. Protect databases and exports before sharing them.
- Missing roots or unsupported formats leave coverage unknown or incomplete. Model cost tables do not provide account billing totals.
- Back up the database before an upgrade.

See the source repository’s RELEASING.md for packaging instructions.

### cc-bridge

You convert visible Claude Code exchanges to daily Markdown with cc-bridge. You select input, output, and resume-state paths. Each invocation reads the newest root-level transcript in one project. Run the demo to inspect a synthetic daily log before choosing your own transcript directory.

```sh
cd components/cc-bridge
bash examples/demo.sh
```

**Limits**

- The logs contain plaintext exchanges. Select records before sending them to a hosted model.
- Each invocation reads one project’s newest root-level transcript. Exports truncate assistant text after 2,000 characters and omit tool results and thinking.
- Reprocessing with reset state can append duplicate exchanges. Concurrent writers and exactly-once delivery are not implemented.

### route-domain

You load configured context files for prompt keywords with the optional route-domain shell hook. You can match several domains in one prompt and emit complete bodies as additionalContext. Review paths and disclosure rules first. The root owned-record Python router emits candidate paths without loading bodies.

```sh
cd components/route-domain
demo_record=$(mktemp -d)
unset CLAUDE_USER_PROMPT
mkdir -p "$demo_record/01 - Work"
printf '%s\n' 'release:: ready' > "$demo_record/01 - Work/_context.md"
printf '%s\n' '{"hook_event_name":"UserPromptSubmit","prompt":"review the release"}' \
  | CLAUDE_PROJECT_DIR="$demo_record" bash ./route-domain.sh
```

**Limits**

- Multiple matches can disclose complete bodies from several context files. Review the configured files before enabling the hook.
- Configured files and symlinks must be trusted. The hook has no filesystem sandbox or maximum context size.
- Keyword matching does not establish intent or authorization. The shipped paths require customization, and no Codex CLI hook adapter is supplied.

For path-only selection without context loading, inspect the `vault-route` helper in [skills](/code/agent-oversight#skills).

### pretool-memory

You retrieve candidate context before selected Claude Code read tools with pretool-memory. You derive a query from recent thinking, request up to three QMD results, and optionally retrieve two SQLite snippets. Run the mock demo before enabling this optional hook against your own corpus.

```sh
cd components/pretool-memory
bash examples/demo.sh
```

**Limits**

- Recall requires readable assistant thinking of at least 100 characters. Write, Edit, and Bash calls do not trigger recall.
- Retrieved text remains untrusted evidence and can enter a hosted-model session. The hook does not act as an approval gate.
- QMD collections must be configured. Optional SQLite recall requires `domain`, `timestamp`, and `content_text` in `fts_unified`.

### voice-calibration

You retrieve writing samples before Claude Code Write and Edit calls with voice-calibration. You match target paths against fixed genre patterns and request up to two QMD results. Review patterns, queries, and approved samples before enabling the hook. The demo uses a mock search executable.

```sh
cd components/voice-calibration
bash examples/demo.sh
```

**Limits**

- Results depend on configured QMD collections and fixed path patterns. Retrieved examples do not guarantee a voice match.
- Samples can enter a hosted-model session after hook installation.
- The hook returns success without approving the requested write.

### web2md

You convert returned HTML into source-attributed Markdown with web2md. You fetch with a bounded timeout and remove configured boilerplate before saving headings, lists, tables, links, and code. Use the documented CLI to retrieve a public page, then compare the Markdown with the source.

```sh
cd components/web2md
python3 -m venv .venv
.venv/bin/python -m pip install -r requirements-dev.txt
.venv/bin/python web2md https://example.com/page --stdout
```

**Limits**

- The tool does not execute JavaScript or bypass access controls.
- Boilerplate matching can remove useful content.
- Images are omitted, and relative links are not rewritten to absolute URLs.

## Limits

Data transfer between clients requires compatible parsers and retrieval adapters. The supplied hooks target Claude Code. The repository supplies no private corpus, hosted service, or capability-level approval gate.

## Model assistance

The root README discloses model assistance for its text. Component READMEs carry their own disclosures. Review the code and tests to assess each tool.

## Related repositories

- [agent-oversight](/code/agent-oversight)
- [vault-crawl](/code/vault-crawl)

[Discuss a scoped build](/work).
