Skip to main content

Epitype

繁體中文

Epitype is a memory governance layer for CLI agents.

It keeps the host's native memory as the storage authority, then adds the structure, timing, action gates, and evidence needed for remembered rules to affect later behavior.

An agent can retrieve the right fact and still break the rule attached to it. Epitype focuses on that gap:

  • a replaced decision should not return as current;
  • an incident lesson should reach the tool action where it matters;
  • a permission should remain attributable to the person who gave it;
  • a memory failure should be visible and testable.

Epitype currently supports Claude Code and Codex. It uses only the Python standard library and does not require a hosted memory service.

How it works

Epitype connects the same native vaults to four host events:

Event What Epitype does
SessionStart Injects a bounded memory index and work ledger when those files exist.
UserPromptSubmit Recalls up to five relevant cards from each resolved vault within the shared output budget. Short owner-grant statements are stored verbatim, deduplicated, and indexed; their meaning is not inferred during capture.
PreToolUse Matches scar-card triggers against the tool and its input. A match returns a bounded denial, safer advice, and an audit row.
PreCompact Builds a small recovery map from the transcript tail before context compaction.

Injected memory remains advisory. It cannot override system or developer instructions, bypass host permissions, or grant a tool authority by itself. Hook output is capped at 10 KiB and each hook has a three-second fail-open deadline.

Governance beyond recall

Current decisions

Decision cards have a stable decision_key, an active or superseded status, an effective time, and a named decision source. Exactly one card should be active for each key. query, recall, and the prompt hook exclude superseded cards by default while retaining them for provenance. Use --include-superseded only when you want the history.

Scars that can stop an action

A scar is an incident-born rule. Adding trigger.tool, trigger.input, and actionable advice turns a suitable scar into a narrow action gate. Command matching inspects executable and unquoted argument positions by default, so a trigger word inside a quoted string, comment, or heredoc body does not block the command. Cards that need literal full-text matching can opt in explicitly.

Native-first installation

The installer merges only entries marked as Epitype, keeps detected native vaults, and writes backups before changing an existing host file. Stable shims let the repository move without rewriting every host registration. Uninstall removes Epitype-owned registrations and configuration while preserving native memory and vault cards.

Failure evidence

Missing indexes, stale indexes, shim failures, malformed cards, and lock contention have distinct outcomes. The hooks fail open when they cannot safely finish, and the installer doctor reports recorded shim outages instead of treating silence as health.

Quickstart

Requirements: Python 3.11 or newer and a Claude Code or Codex installation with hook support.

Install: pip install epitype, then use the epitype-graft command in place of python install/graft.py below (for example epitype-graft install --dry-run).

The epitype package on npm is only a signpost back to this Python project.

From the repository root, preview the planned changes:

python install/graft.py install --dry-run

If the preview contains only the hosts and paths you expect, install and run the synthetic health check:

python install/graft.py install
python install/graft.py doctor

The installer detects existing native vaults. If it finds none, it creates an empty fallback vault. Reinstall preserves a curated vault list; use python install/graft.py vaults --resync --dry-run and then rerun without --dry-run when you intentionally want to adopt the latest detection result.

Approve Codex hooks

Codex registration and Codex trust are separate. Check the real trust state after installation:

python adapters/codex/hook_trust.py check

If any Epitype entry is UNTRUSTED, DISABLED, or MODIFIED:

  • In the terminal UI, enter /hooks, press t to trust all entries in the panel, then press esc.
  • In the Desktop app, open hooks need review or the Hooks panel and approve the Epitype entries for SessionStart, UserPromptSubmit, PreToolUse, and PreCompact.

Run the check again. Codex is ready only when it prints CODEX TRUST: PASS 4/4. doctor verifies registration and synthetic execution; it does not replace this trust check.

Choose a vault layout

Start from one of the tracked templates:

Template Intended use
minimal One person on one machine.
team A shared vault using the common write-lock contract.
power The full layout, including census and exam-ready directories.

Search the local vault

Build a vault's local FTS index, then query it directly or recall against a prompt:

python epitype/memsearch.py build C:\path\to\vault
python epitype/memsearch.py query term --vault C:\path\to\vault
python epitype/memsearch.py recall "natural-language prompt" --vault C:\path\to\vault

The generated database lives at <vault>/.epitype/memory_fts.sqlite3 and is ignored by Git. Only build creates a missing index. Existing indexes refresh incrementally when stale; a missing index is reported separately from a valid zero-result query.

Verify this checkout

Run the public checks from the repository root:

python tests/run_all.py
python tests/privacy_lint.py
python exam/exam_runner.py --strict

tests/run_all.py currently runs 17 component selftests covering the core tools, hook adapters, installer, exam engine, and privacy gate. The included exam corpus is a small synthetic sample. For this release, the publication gate also passed a strict 300-case behavior corpus and a 15-seed review; those release materials are not part of this repository.

These checks are regression evidence, not proof that every future host version or every memory failure is covered.

Moving or removing Epitype

After moving the repository, update the stable shim target and rerun the doctor:

python install/graft.py relocate --to C:\path\to\new\repo

Preview uninstall before removing Epitype-owned files:

python install/graft.py uninstall --dry-run
python install/graft.py uninstall

Read Uninstall Epitype before restoring a backup manually.

Limits

  • Hooks can govern only events and tools the host exposes. Direct file reads remain outside Epitype's current-decision filter.
  • The time and output ceilings require selection; Epitype never injects the entire vault into every prompt.
  • Action gates are only as precise as their scar triggers and advice. Malformed cards fail open rather than taking control of the host.
  • Claude Code and Codex are the tested host boundary. A host upgrade still needs integration testing.
  • The bundled tests are synthetic. They exercise behavior and failure handling, not long-term field performance.

Documentation

  • Architecture: memory blocks, retrieval routes, decision cards, scar lifecycle, and authority rules.
  • Failure modes: symptoms, countermeasures, and verification boundaries.
  • Uninstall: ownership-aware removal and backup guidance.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

epitype-1.0.0.tar.gz (104.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

epitype-1.0.0-py3-none-any.whl (115.6 kB view details)

Uploaded Python 3

File details

Details for the file epitype-1.0.0.tar.gz.

File metadata

  • Download URL: epitype-1.0.0.tar.gz
  • Upload date:
  • Size: 104.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for epitype-1.0.0.tar.gz
Algorithm Hash digest
SHA256 2fed8d0784bfd570b1c304d1a9609b32a208d9322b62045c0f0253d58f8dee40
MD5 509cdbae236fd5b22a2400bc5d8c9b72
BLAKE2b-256 dc7472311839d9607e3edaa0a84940f1e205b6ba8f890176dcee770cf9997e11

See more details on using hashes here.

Provenance

The following attestation bundles were made for epitype-1.0.0.tar.gz:

Publisher: publish.yml on leavemagic-cyber/epitype

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file epitype-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: epitype-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 115.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for epitype-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e3021458068d350b0b4f97f77fc4a829ccfcd3c9d7f418ae886c3bac41a9ed31
MD5 a630961026b5877dcb6cf18f0f6d43b2
BLAKE2b-256 3833741dbf69faaa6aa08258aac02e6bacdcfcaa8068337c6b587777bba87a6f

See more details on using hashes here.

Provenance

The following attestation bundles were made for epitype-1.0.0-py3-none-any.whl:

Publisher: publish.yml on leavemagic-cyber/epitype

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

1.3.0

2 files

1.2.0

2 files

1.1.0

2 files

This release

1.0.0 This release

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page