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, presstto trust all entries in the panel, then pressesc. - In the Desktop app, open hooks need review or the Hooks panel and approve the Epitype entries for
SessionStart,UserPromptSubmit,PreToolUse, andPreCompact.
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2fed8d0784bfd570b1c304d1a9609b32a208d9322b62045c0f0253d58f8dee40
|
|
| MD5 |
509cdbae236fd5b22a2400bc5d8c9b72
|
|
| BLAKE2b-256 |
dc7472311839d9607e3edaa0a84940f1e205b6ba8f890176dcee770cf9997e11
|
Provenance
The following attestation bundles were made for epitype-1.0.0.tar.gz:
Publisher:
publish.yml on leavemagic-cyber/epitype
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
epitype-1.0.0.tar.gz -
Subject digest:
2fed8d0784bfd570b1c304d1a9609b32a208d9322b62045c0f0253d58f8dee40 - Sigstore transparency entry: 2684456719
- Sigstore integration time:
-
Permalink:
leavemagic-cyber/epitype@57b7857cf8fe84d99625c446d90ae238e8f2e9a1 -
Branch / Tag:
refs/tags/v1.0.0 - Owner: https://github.com/leavemagic-cyber
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@57b7857cf8fe84d99625c446d90ae238e8f2e9a1 -
Trigger Event:
push
-
Statement type:
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e3021458068d350b0b4f97f77fc4a829ccfcd3c9d7f418ae886c3bac41a9ed31
|
|
| MD5 |
a630961026b5877dcb6cf18f0f6d43b2
|
|
| BLAKE2b-256 |
3833741dbf69faaa6aa08258aac02e6bacdcfcaa8068337c6b587777bba87a6f
|
Provenance
The following attestation bundles were made for epitype-1.0.0-py3-none-any.whl:
Publisher:
publish.yml on leavemagic-cyber/epitype
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
epitype-1.0.0-py3-none-any.whl -
Subject digest:
e3021458068d350b0b4f97f77fc4a829ccfcd3c9d7f418ae886c3bac41a9ed31 - Sigstore transparency entry: 2684456724
- Sigstore integration time:
-
Permalink:
leavemagic-cyber/epitype@57b7857cf8fe84d99625c446d90ae238e8f2e9a1 -
Branch / Tag:
refs/tags/v1.0.0 - Owner: https://github.com/leavemagic-cyber
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@57b7857cf8fe84d99625c446d90ae238e8f2e9a1 -
Trigger Event:
push
-
Statement type: