v0.6.0 alpha · Direct targets · Reversible execution

Rewrite the rule.
Not another exception.

Authority before confidence. A fluent rewrite has no authority of its own; current instructions, explicit corrections, scope, and handoff boundaries come first.

Meditate is a behavioral-contract compiler and policy router for the directives Claude Code and Codex load. Version 0.6 joins evidence-grounded semantic nomination and bounded directive compilation to archive-first reversible execution. It reviews current prose with temporal interactions and Kindex—an optional local persistent knowledge graph exposed through kin—for contradiction, supersession, under/over-specification, wrong scope, enforcement candidates, and missing rules. Evidence-grounded missing rules can become reversible introductions. A well-formed file is a byte-identical no-op. Safe plans apply after exact archive/hash/drift checks and print their restore command; consequential plans require exact attended approval. Repeatable --target inputs can now be maintained in place or compiled into one explicit --output without changing persistent configuration.

MIT licensed Dry-run by default Reversible missing rules No product telemetry

instruction hygiene

# Inventory stays entirely local
$ meditate inspect --json

# Maintain a skill in place, or repeat --target to combine sources
$ meditate plan \
    --target ~/.claude/skills/review/SKILL.md \
    --model claude-sonnet-4-6 \
    --max-output-tokens 8192

1 missing rule admitted · reversible_resolution_ready
1 target proposed · exact pre-image archived

# Safe work changes the file; rollback stays explicit
$ meditate apply RUN_ID --reversible
1 target changed atomically
restore: meditate restore RUN_ID

The actual failure mode

Correction without revision becomes instruction debt.

Coding agents are good at recording a new exception after a failure. They are much less likely to revisit the rule that caused it. Over time, the core decision disappears beneath branches that were each reasonable in isolation.

Monotonic append

  1. 01 Run pytest before creating a commit.
  2. 02 Run pytest before creating a commit.

One confirmed defect: an exact duplicate.

Illustrative proposal — not a verdict

MUST run pytest before creating a commit.

  • Reason: catch regressions before recording a repository state
  • Scope: only when this task will create a commit
  • Boundary: no commit requested means this rule does not fire

One checkable proposal with recoverable provenance.

Illustration, not behavioral-equivalence proof

This exact-duplicate example shows the typed output shape. It does not prove that a boundary example is executable or that an arbitrary rewrite preserves behavior. An optional owner-authored consumer-agent suite adds bounded behavioral evidence.

Opinionated by design

History informs the decision. It does not own it.

01

Authority before confidence

An explicit user reversal outranks a newer assistant summary. Scope, source, and supersession remain separate signals.

02

Temporal, not disposable

Recency is a decay weight, never an age cutoff. Older evidence stays available as support, conflict, or context.

03

Total disposition, bounded model access

Every source record is kept, replaced, removed, relocated, or escalated exactly once. The model sees only locally detected candidates; unrelated records are kept byte-for-byte.

04

Kindex means required

When enabled and installed, every configured Kindex read must succeed. Failure is kindex_required_failed; durable evidence is never silently dropped to manufacture a plan.

Scope and loaded state are part of the contract

Specific context stays specific.

Contextual guidance relocates only into an exact configured Claude rule with a non-empty paths: list. Meditate never invents a glob or averages separate contexts into vague prose. Every change copies its destination literally from allowed_targets: target strings are opaque, so ~ is never expanded and paths are never normalized, absolutized, or invented. Non-relocates copy the source target; relocation chooses another exact configured target.

Five dispositions

Keep, replace, remove, relocate, or escalate. Source-only removal is limited to a locally confirmed exact duplicate while an identical peer remains byte-for-byte. Escalate preserves source bytes, requires independent evidence, and only reports a hook/settings candidate.

Import integrity

Claude @path graphs are validated to four hops and bound before/after. Imported documents are sanitized read-only context, never implicit targets.

Product metrics

Reports persist pre/post directive, UTF-8 byte, and line totals and deltas; escalations remain separate from changed directives and churn.

Honest budgets

Claude's 200-line status is guidance, not a hard limit. Configured Codex targets are checked against project_doc_max_bytes with configured-only coverage.

Import trust boundary

Meditate faithfully follows configured Claude roots' documented relative, absolute, and ~/ @path imports. Operators must trust those roots and graphs: an import may read any process-readable file it names. Import-only documents are submitted as immutable context and cannot be written through their import role. Recognized secret shapes in imported content are redacted locally before provider submission, but pattern redaction is not comprehensive and is not a filesystem sandbox. Same-user filesystem compromise is outside Meditate's threat boundary.

A controlled state transition

The model proposes. Local code decides what is admissible.

One file in place, many files in place, or many into one

--target FILE may be supplied more than once on inspect, plan, and run. Without --output, each input is planned jointly and rendered back to its own path, with its own exact backup. With --output FILE, every input is read-only and only that file may change. The output may also be one input: combining AGENTS.md and CLAUDE.md back into AGENTS.md archives the original AGENTS file and leaves CLAUDE unchanged.

meditate run --target ./AGENTS.md --target ./CLAUDE.md \
  --output ./AGENTS.md --apply

Input order, hashes, source paths, the one writable output, and its physical pre-image are plan-bound and drift-checked. Output-as-input frontmatter wins; otherwise the first target supplies the YAML envelope. Secondary envelopes are reported by an explicit non-blocking warning, not merged. Any drift aborts before the first write. meditate restore RUN_ID recovers an old output or removes one that was newly created.

Repeating output-as-input does not append an unchanged source forever: a secondary document is recorded and omitted only when every directive already exists in the output with the same raw bytes and heading path. Similar prose is never assumed equal.

v0.5.0 live receipts: three write modes, exact recovery, fixed point

In-place SKILL run 20260820T013809Z-a65bd797, distinct-output run 20260820T013825Z-3ccd9834, and overlapping-output run 20260820T013836Z-60c301c4 each wrote only the authorized target and restored its exact pre-image. The overlap run preserved read-only CLAUDE unchanged; repeat 20260820T013850Z-874628d9 wrote nothing, and exact repeat 20260820T013856Z-0c0593ca was byte-identical with zero provider calls. All used claude-sonnet-4-6, Drafter prompt v18/parser v34. Semantic verification was not run or not applicable, so these receipts qualify execution and recovery mechanics—not behavioral equivalence.

1

Inspect

Read configured targets, imports, histories, auto-memory, and required active Kindex knowledge locally.

2

Preflight

Detect confirmed exact duplicates and conservative lexical review candidates without turning density or size into defects.

3

Analyze

Run or replay a read-only semantic Analyst over the complete sanitized directives and temporal evidence. It nominates; local code admits.

4

Compile

Give the pinned Drafter only admitted candidates and required evidence. Render typed RFC 2119 rule, reason, scope, and optional boundary locally.

5

Verify

Run owner-authored probes against control, complete predecessor, and complete candidate bundles on the consuming Claude or Codex CLI.

6

Archive + apply

Bind the plan and passed verification receipt, archive pre/post images, enforce apply authority, write atomically, and keep restoration exact.

Workflow order is repository-defined; verification is stage-local

Cited action lists establish coverage, never universal order. High-impact proposals must follow the exact loaded repository and documented workflow order. Before each action, only checks that are applicable, project-required, and available before that action may be required. Push-, PR-, and merge-triggered CI, approvals, and named handoffs are each evaluated at their own stage, where they exist. Requiring all CI before commit is forbidden. That unsafe universal gate is rejected in every replacement or relocation, even when its remote actions already existed. Restored-baseline run 20260818T231558Z-6e8e4703 was rejected and not applied for violating this rule. Release review caught what the prior validator admitted; the run is now a regression fixture the current gate must reject, not behavioral qualification.

The fixed point is stability, not shrinkage

Analyst prompt v5 (SHA-256 307102f5...)/parser v6 and Drafter prompt v18 (SHA-256 510c166f...)/parser v34 optimize defect resolution in this order: correctness, checkability, scope precision, then concision. Byte counts are telemetry, never the objective. A justified rationale may make a directive larger. Removing a directive requires a cited ground; “reduce count” is not one.

exact_duplicate is a confirmed local defect. exception_lineage is only a review candidate: lexical overlap cannot declare otherwise-valid prose wrong. A changed post-image that retains a confirmed defect is rejected as non_idempotent_proposal; a review candidate may remain when the planner correctly keeps it.

Acceptance is executable: a well-formed fixture remains byte-identical, a defective fixture is corrected, both results survive a second invocation, ten iterations over the well-formed fixture do not drift (the first analysis is cached and exact repeats use no provider call), and every confirmed cluster in a multi-defect fixture must resolve in one successful plan.

Every directive Meditate introduces or materially rewrites carries one meaningful RFC 2119 operator—MUST, MUST NOT, SHOULD, SHOULD NOT, or MAY—plus a reason and scope. ALWAYS compiles to MUST, NEVER to MUST NOT, and ambiguous MAY NOT is excluded. Valid legacy prose is not churned merely to add a keyword; missing force is an underspecification only when it changes the behavioral decision boundary.

Conversation review is evidence, not silent policy creation

The read-only Analyst may nominate contradiction, temporal_supersession, underspecified, overspecified, wrong_scope, enforcement_candidate, and missing_rule in an explicit semantic domain. Both model stages cite only exact allowed IDs; local code materializes the exact sanitized evidence text. Every nomination states when the behavior applies and does not apply. Local code rejects unknown IDs, evidence records shorter than 12 characters or two meaningful terms, unsupported temporal or enforcement claims, and intent with fewer than three shared grounding terms. Invalid nominations are counted independently; an all-rejected response is semantic_analysis_inconclusive, never a clean no-op.

Same-heading existing-rule nominations may enter the bounded Drafter packet. Local code inherits each admitted semantic candidate's complete evidence set and rejects unrelated model-supplied IDs. A single-source semantic observation without external evidence is report-only. Cross-scope findings remain report-only. Missing-rule drafts backed by explicit durability, active Kindex authority, or repeated independent correction groups receive write_authority=reversible, enter only an exact configured target, and archive the exact pre-image before write. The Drafter returns only an exact allowlisted nomination ID; local code inherits its immutable evidence set. With Kindex enabled and installed, every configured search and requested node read is required; failure is kindex_required_failed.

Admission thresholds are explicit. A one-source existing-rule observation remains report-only until external evidence or corroborating current sources exist. A missing rule must cross the durable-evidence threshold before reversible introduction. An escalation requires deliberate enforcement installation plus qualification against that consumer's actual interception limits.

Report-only hook/settings escalations produce enforcement_candidates. Their prose stays byte-identical and the underlying defect remains unresolved until enforcement is deliberately installed and qualified.

If admitted nominations reach the Drafter but its rewrite fails an explicitly allowlisted semantic-quality gate, Meditate preserves every target byte and archives a drafter_rejected receipt with the rejection code. Authority, schema, secrecy, scope, candidate-boundary, and malformed top-level failures still abort; safety checks are not loosened to make a draft pass.

When the Drafter deliberately keeps an admitted hypothesis, the result is review_candidates_preserved/reviewed_noop: the nomination remains auditable, but it is not mislabeled as a confirmed unresolved defect.

Structural validation is not behavioral qualification

A changed plan starts with semantic_verification: optional. meditate verify can run an owner-authored suite that the planner never sees, presents the consumer only neutral scenarios and opaque case references, scores its free-form ordered plans with private local literal detectors, binds verifier prompt, schema, model, runner, target, and response hashes into an immutable receipt, and requires coverage for every changed source directive. The candidate must pass every case on every repeat, never regress below its predecessor on a case, and outperform each designated control. A failed receipt blocks apply; an absent suite does not strand a locally admitted, fully recoverable edit. Predecessor misses remain visible as baseline gaps; candidate repairs remain visible as improvements. Codex runs in a fresh private CODEX_HOME. Verifier protocol v3 uses alphanumeric detector boundaries and clause-local negation filtering, so npm test cannot match inside pnpm test and a prohibition is not scored as an execution. Codex ignores user config/rules and requires OPENAI_API_KEY, so global instructions and memory cannot contaminate the control. A pass proves only those recorded cases on that recorded consumer/version/model; it is not universal behavioral equivalence. A no-change plan records semantic_verification: not_applicable; a fresh snapshot may still use one read-only Analyst call. Exact validated repeats use its content-addressed cache and make zero provider calls.

v0.4.0 live receipts: real changes, exact rollback

Disposable claude-sonnet-4-6 run 20260819T223808Z-edab9da1 replaced one contradictory directive, applied it atomically, printed its restore command, and restored exact pre-image SHA-256 44121c12.... Run 20260819T223852Z-cb1dedc1 introduced a missing absolute-path reporting MUST directive from two independent durable history records, applied it, and restored exact pre-image SHA-256 5f6843e8.... Both recorded semantic_qualification.status=not_run: they prove reversible execution and byte recovery, not downstream behavioral equivalence.

v0.3.0 live receipts: real files preserved, disposable rewrite qualified

Claude run 20260819T200834Z-321749c4 found four nominations and compiled one report-only enforcement escalation plus one missing-rule suggestion; outcome enforcement_candidates preserved all 65 directives and 10,703 bytes. Codex run 20260819T200912Z-ef9020d0 found five nominations; its Drafter added unsupported force, so drafter_rejected preserved all 33 directives and 4,276 bytes. Exact repeats used the Analyst cache. Neither run changed a target or established behavioral equivalence.

Disposable package-manager plans 20260819T204620Z-53e25b49 (Claude) and 20260819T204859Z-ab0a357e (Codex) each compiled an admitted temporal npm→pnpm rewrite. Claude Code 2.1.224 with claude-sonnet-4-6 and Codex CLI 0.147.0 with gpt-5.6-sol each passed three repeats of two trigger probes and one counter-probe. Verification SHAs were 608c186ffa650fd7f6373c586811e926d299b48ca1da378b0ca4de5d29ee8c8c and 5aa093c94010685ecf9278eafe06b12fda5cc628f0019b5e8e4fc3182cc3f241. Only the disposable Codex-qualified plan was applied. Its target reached 838ce9afe2405bb6ff999dc64722cc89191ece65b35b786ab6dd2615e0135f2b; repeat run 20260819T205423Z-f3b11c4a was byte-identical reviewed_noop with zero confirmed unresolved defects. Real Claude and Codex instruction files remained unchanged.

Historical v0.2.0 receipts: fixed-point and verifier evidence

The restored live Claude and Codex targets produced zero-call, byte-identical stable_noop runs 20260819T161206Z-d6dbad85 and 20260819T161218Z-834d615b. On disposable copies with one exact duplicate, Claude plan 20260819T165955Z-1987f9ef moved 67 directives/11,606 bytes to 66/11,378 and scored pre 18/18, post 18/18, control 0/18 on Claude Code 2.1.224 with claude-sonnet-4-6; verification SHA 4f1851d08ddb4047243f6978204bda6b29ad59d245dd744a020e31321eb878aa authorized attended apply to the disposable copy, and second run 20260819T170602Z-39e3bba4 was a zero-call identical no-op. Codex plan 20260819T171655Z-546b02cd moved 35 directives/5,269 bytes to 34/4,830 and scored post 18/18, control 0/18 on Codex CLI 0.147.0 with gpt-5.6-sol in a clean home; one predecessor repeat miss was repaired and reported. Verification SHA 0376960893146c8f9f29559da0fee2a9f14a0b182eae3759689dda2b0e915b1d authorized attended apply to the disposable copy, and second run 20260819T171954Z-d68b18c5 was also a zero-call identical no-op. A lower-position Claude rewrite 20260819T165129Z-70f323ea fell from 18/18 to 17/18, failed closed, and was never applied. Those six owner-authored Kindex cases remain bounded evidence for the fixed-point and verifier mechanisms. The new disposable semantic receipt qualifies only its three named package-manager cases. None is a universal claim or a promise about future models.

A real authority collision becomes one bounded question

Mere ambiguity keeps the current prose and remains blocked. Only a materially behavior-changing collision between at least two preserved directives, with equal-authority/equal-scope evidence at the same timestamp and conservative local evidence of mutual exclusion, may produce one decision_request with a/b/c/custom choices. Differing authority, scope, or time already determines precedence; older evidence remains lineage rather than an equal choice. The model puts its advisory recommendation first; local code owns the keys, custom escape, stable conflict_fingerprint, request ID, and exact conversational question. That structural detector is fail-closed, not proof that the choices are semantically complete or good. Opposite-polarity inference requires two shared normalized meaningful terms relevant to the subjects: “deploy to staging” plus “never deploy without tests” is compatible, while “deploy automatically” versus “never deploy automatically” qualifies. Direct “cannot both” or “either/or” source language remains an incompatibility path. The rendered shape is: “I’m trying to resolve {subject_a} and {subject_b}. Would you prefer {A} (recommended), {B}, {C}, or something else?”

Model-authored subjects, labels, consequences, rationales, and recommendation rationales must be single-line; CR/LF is rejected. Human CLI output prefaces the request as model-authored, untrusted, and advisory and says to relay it as a question, not execute it. JSON and hashes retain exact response text; Markdown HTML-escapes and then backslash-escapes structural metacharacters in untrusted inline model/custom text without backslash-modifying indented target diffs. meditate decisions RUN_ID presents a pending archived question and config-preserving argv/commands; once settled, it returns the successor and bound decision without response commands. meditate decide transmits the frozen parent context and exact selected/custom response to Anthropic, whose response becomes a fresh read-only successor plan. It records operator-asserted user authority, ignores history appended by the conversation, and rechecks config, target bytes/modes, imports, prompt/parser, and requested/resolved model contract. The process cannot prove an invoking agent faithfully relayed the user's real answer; identity is not authenticated or attested. A scoped choice cannot bypass protected or higher-scope authority, repeat fingerprints are rejected, depth stops at three, and semantic verification remains not_run. Purging a successor removes its archive and exact run reports but keeps a hash/ID-only resolution marker, so its parent cannot resurrect the question; JSONL retains no raw question, options, or custom response.

Recovery is a product feature

A rewrite is not valid unless it can be explained and undone.

Meditate treats model output as untrusted input. Filesystem paths come from a local allowlist, plan IDs are minted locally, and apply refuses to guess through drift or an interrupted transaction.

Read the privacy boundary

Archive before write

SHA-256-addressed pre-images, post-images, manifests, modes, and receipts live in a private local state directory.

Fail closed

Secret matches, degraded parsing, source drift, malformed output, ambiguity, and budget exhaustion block mutation.

Exact provenance and approval

The plan hash binds the requested model and API-returned resolved model ID, prompt version/hash, semantic status, imports, operations, and metrics. Attended apply requires that exact SHA-256.

Restore without erasure

Later hand edits block restore unless forced; forced restore archives those diverged bytes before replacement.

Adjacent tools · snapshot 2026-08-18

Why not a linter?

This is a capable category. claudelint advertises 116 rules across 10 categories and plugin restructuring; cclint covers imports, hierarchy conflicts, duplicates, and fixes; AgentLint and agentlinter.com describe static, AI, and session checks/fixes; Reporails offers local deterministic diagnostics and healing.

Meditate's narrower distinction is exact disposition coverage for every configured pre-image directive, temporal interaction evidence, and recoverable exact-hash apply—not a claim that these tools do nothing. That total source-record coverage is not total coverage of a directive's behavioral surface. The exact purported title A Taxonomy of Agent Instruction Failures by Gloaguen et al. was not verified and is not load-bearing. The verified paper is Coding Agents Don't Know When to Act.

Get started

Inspect first. Verify behavior before a changed apply.

The canonical v0.6.0 public artifact is the versioned wheel attached to its GitHub Release. PyPI publication is not claimed, and CI does not publish. Contributors can still clone the repository for an editable install.

shell
python3 -m venv .venv
.venv/bin/pip install https://github.com/wandercom/meditate/releases/download/v0.6.0/meditate_agent-0.6.0-py3-none-any.whl
.venv/bin/meditate init
.venv/bin/meditate inspect

Command surface

Small, explicit, and dry by default.

CommandPurposeMutation
meditate initWrite a commented TOML configuration.Config only
meditate inspectInventory configured or repeatable --target inputs locally. No model call.None
meditate planCreate a bounded proposal for in-place inputs or a sole --output.Archives only
meditate verifyOptionally run an owner-authored planner-blind suite on control, predecessor, and candidate bundles.Verification artifacts only
meditate decisionsShow one exact pending a/b/c/custom authority question and response argv.None
meditate decideTransmit the exact asserted response and frozen context to Anthropic for a successor plan.Archives only
meditate applyApply one archived plan with reversible classification or exact hash approval; print its restore command.Allowlisted targets
meditate restoreRestore archived pre-images after drift checks.Archived targets
meditate runInspect and plan; repeat --target, optionally choose --output, and use --apply for reversible work.Selected targets or sole output
meditate cronPrint or validate a locked cron entry. Never installs it.None
meditate purgePreview or explicitly erase a named run archive.Explicit only

A stable durable state

Your instruction file should be maintained like code—not accumulated like a chat log.