Carry, relay, rewind, triage, verify, or search coding agent cognition across Codex, Claude Code, OpenCode, Antigravity (agy), ACP agents, and plugins (legacy Gemini CLI read-only) with Constant. Use when the user asks to hand off or rescue a thread mid-task, race multiple models behind tamper-proof tests, apply a verified patch with a Cognitive Receipt, rewind before bad turns, search across recorded sessions via FTS5, ablate CLAUDE.md, or mentions Constant by name.
Installs into .claude/skills of the current project.
Sponsors
SSkills DirectorySkills Directory
Know which skills are safe — weekly.
SSkills DirectorySkills Directory
Is that skill safe to install?
Are you the author of Constant?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/kennykankush-constant)
---
name: constant
description: "Carry, relay, rewind, triage, verify, or search coding agent cognition across Codex, Claude Code, OpenCode, Antigravity (agy), ACP agents, and plugins (legacy Gemini CLI read-only) with Constant. Use when the user asks to hand off or rescue a thread mid-task, race multiple models behind tamper-proof tests, apply a verified patch with a Cognitive Receipt, rewind before bad turns, search across recorded sessions via FTS5, ablate CLAUDE.md, or mentions Constant by name."
allowed-tools: Bash(constant --version), Bash(constant --help), Bash(constant doctor:*), Bash(constant runtimes:*), Bash(constant harnesses:*), Bash(constant sessions:*), Bash(constant ps:*), Bash(constant route:*), Bash(constant recall:*), Bash(constant search:*), Bash(constant index:*), Bash(constant record:*), Bash(constant ask:*), Bash(constant rewind:*), Bash(constant relay:*), Bash(constant runs:*), Bash(constant apply:*), Bash(constant replay:*)
---
# Constant — Portable Agent Cognition (v0.13.0)
Constant is local-first agent cognition infrastructure across coding harnesses. It seals one unedited **Dry Master** record (`record`), compiles past compaction cliffs with zero LLM calls (`--render triage`), rewinds cleanly before bad turns (`rewind`), rescues mid-task usage cliffs in one command (`relay`), indexes every Dry Master in local SQLite FTS5 (`search --all`), races `harness:model` cells in isolated git worktrees behind SHA-256 test guards (`ask --protect-tests`), lands verified patches with PR-ready Cognitive Receipts (`apply`), and runs blinded `CLAUDE.md` / render ablations (`replay --ablate-file --compare-renders`).
- Native carry/relay targets: `codex`, `claude`, `opencode`, or any `write_native` plugin.
- Built-in headless `ask` / `replay` targets: `codex`, `claude`, `opencode`, `antigravity` (`agy`), plus any configured ACP agent (`~/.constant/runtimes.json`) or `constant-adapter-*` plugin.
- Antigravity (`agy`) and legacy Gemini CLI sessions can be read, recorded, searched, recalled, and carried from (and Antigravity can be consulted directly via `constant ask --to antigravity`, returning a resumable `agy -r <id>`).
## Prefer MCP when connected
If Constant is registered over stdio MCP (`constant mcp`), prefer calling the 7 in-process tools directly:
`constant_ask`, `constant_record`, `constant_search` (pass `all: true` for cross-session FTS5 search), `constant_recall`, `constant_carry`, `constant_sessions`, and `constant_runtimes`.
## Learn the installed CLI
The installed binary is the authority for syntax. Check it first:
```bash
constant --version
constant doctor --json # installed runtimes, versions, and whether each is validated
```
Always pass `--json` (or `--plain`) on read commands. Never run interactive TTY commands (`constant host`, `constant resume`, or bare `constant trail` / `constant sessions` without `--json`) from an agent.
## Identifying the active session
Name your own session explicitly instead of guessing:
| You are running in | Your session id |
| --- | --- |
| Claude Code | `$CLAUDE_CODE_SESSION_ID` |
| Codex | `$CODEX_THREAD_ID` |
| Antigravity (`agy`) | `$ANTIGRAVITY_CONVERSATION_ID` |
| OpenCode / other | `constant sessions --from <runtime> --json`, newest `id` for this `cwd` |
## Core Workflows
### 1. Parallel multi-mind verification + tamper guard + patch landing
```bash
# Race harness:model cells in isolated git worktrees with SHA-256 test protection
constant ask --to claude:sonnet,codex:o3,antigravity \
--session "$CLAUDE_CODE_SESSION_ID" \
--with-tools --render triage --isolate worktree \
--protect-tests --verify-cmd "cargo test" \
--question "Find the root cause and propose a minimal fix." --json
# Inspect saved runs and land the verified, untampered winner + Cognitive Receipt
constant runs --json
constant apply latest --dry-run --json
constant apply latest --receipt --json
```
- `--protect-tests` (and `--protect-paths PATH[,...]`) hash-lock test files before target execution. Any edit/delete/addition marks `verify.tampered = true`, forces `verify.passed = false`, and makes `constant apply` refuse that target without `--force`.
- Every target reports exact `usage` (`input_tokens`, `output_tokens`, `cache_read_tokens`, `cache_creation_tokens`, `reasoning_tokens`, `cache_hit_pct`).
- Long prompts can be passed over stdin via `--question - < prompt.txt` so questions stay out of child argv.
### 2. 1-command usage-cliff rescue (`relay`) & native `carry`
```bash
# Auto-detect the freshest active session in cwd, compile triage v2, attach live dirty git status
constant relay codex --json
# Explicit native carry with preview
constant carry --session "$CLAUDE_CODE_SESSION_ID" --to codex --with-tools --render triage --dry-run --json
constant carry --session "$CLAUDE_CODE_SESSION_ID" --to codex --with-tools --render triage --json
```
Compiler `--render triage` v2 runs deterministically with zero LLM calls:
- Pins Turn 1 and constraint/decision turns verbatim.
- Prunes superseded duplicate file reads (dead-store elimination, `receipt.superseded_reads`).
- Folds obsolete errors once a later passing call of the same action succeeds (`receipt.resolved_errors`), while keeping live unresolved errors verbatim.
- Collapses bulky passing tool logs (`> 400` chars) into exact `constant recall` pointers without thinning the sealed Dry Master.
Return the target `resume` command and structured `receipt` to the user. Your in-progress turn is still flushing while you invoke `carry`/`relay`, so the projection ends at the last completed turn.
### 3. Rewind before a bad turn (`rewind` / `--until-turn`)
```bash
constant rewind cobalt-37 --turn 6 --to claude --render triage --with-tools --json
```
Seals the full Dry Master first, then slices the projection cleanly after 1-based Turn K (keeping paired tool traffic through Turn K) and mints a fresh fork without overwriting prior projections.
### 4. Sub-millisecond cross-session recall (`record`, `index`, `search --all`, `recall`)
```bash
constant record --session "$CLAUDE_CODE_SESSION_ID" --json # idempotent by source_sha256
constant search --all "ECONNRESET" --tools --json # SQLite FTS5 across ALL Dry Masters
constant search cobalt-37 "norway yaml" --tools --json # single-handle lexical search
constant recall cobalt-37 ch04 12 --tools --json # exact verbatim turn + redacted tools
constant index --rebuild --json # rebuild & checkpoint ~/.constant/index.sqlite
```
### 5. Blinded ablation & render benchmarking (`replay`)
```bash
constant replay --corpus ./evals --targets claude:sonnet,codex:o3 \
--with-tools --pin-commit --protect-tests --verify-cmd "cargo test" \
--ablate-file CLAUDE.md --compare-renders full,triage --out report.json
```
Runs crossed isolated-worktree arms (`baseline` vs `ablated`, `full` vs `triage`) without touching the parent repository and emits `HELPS` / `HURTS` / `NEUTRAL` verdicts, pass-rate deltas, render compression stats, and per-target token receipts.
## Guardrails
- Treat `ask` and `replay` as billable provider work: invoke only when the user asks or authorizes it.
- Carry, relay, or apply only when the user asks for it.
- Never run `constant host` or `constant resume` from an agent.
- Never run the `gemini` binary to inspect legacy stores; read Gemini sessions through Constant directly.
- Never delete native runtime session stores; use `constant purge` for vault-confined cleanup of Constant-owned snapshots, ledger rows, and FTS5 index entries.
- Redaction burns common secrets across prose and nested tool payloads (while preserving plain English prose like `"bearer tokens"`), not every conceivable secret. Do not cross a trust boundary with a thread the target runtime should not read.
- If `constant doctor` flags a runtime version outside the validated line, tell the user before writing to it.