Skip to content
HyperExtendedRealityPublic

About

Lossless context compression & token-efficiency engine for AI coding agents (Antigravity 2.0, Claude Code, Codex). 94% measured savings, 14× faster Rust hot-path with pure-Python fallback.

Topics

Resources

Stars

4 stars

Watchers

1 watching

Forks

Latest commit

 

History

38 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Terser — Lossless Context Compression for AI Coding Agents

Version Benchmark savings Python License

Local context compression and persistent code indexing

Native Rust hooks and a shared MCP index for Antigravity, Claude Code, Codex, opencode, and Cursor.

Quick start · Benchmarks · How it works · Live HUD · CLI · Configuration

Quick start

Use Python 3.10+ for the runtime and 3.11+ to build the Codex marketplace. The core runtime uses the standard library. Rust is optional. The installer can reuse, build, or download the native accelerator. Pass --no-native for Python hooks.

git clone https://github.com/HyperExtendedReality/terser.git
cd terser
Host Install What you get
Antigravity 2.0 / IDE / agy python scripts/install.py --antigravity Plugin under ~/.gemini/config/plugins/terser/, native launchers, Counter MCP, and sidebar HUD
Claude Code python scripts/install.py --claude, then run the two marketplace commands it prints Hooks, Counter MCP, slash commands, and skills. Install the HUD separately from the same marketplace.
Codex python scripts/install.py --codex, then run the two marketplace commands it prints Local marketplace in dist/codex with hooks, MCP, and skills
opencode python scripts/install.py --opencode, then add the MCP entry it prints V1 tool hooks and Counter MCP
Cursor python scripts/install.py --cursor Hooks and MCP merged into your Cursor config

python scripts/install.py --all prepares Antigravity, Codex, and Claude Code. Use --dry-run to preview. The Antigravity installer stages the bundle and probes its hooks and MCP server before replacing the live plugin. Run python scripts/install.py --antigravity --doctor to probe an existing installation, or python runtime/cli.py --host codex doctor to check Codex. For opencode and Cursor, use the installer with --doctor and the corresponding host flag.

Optional: local Firecrawl for fetch_and_index

Firecrawl Local is a single binary that returns clean main-content Markdown, including JavaScript-rendered pages when Chrome or Chromium is installed. Terser uses it for fetch_and_index when it is available and otherwise keeps the built-in parser, so nothing depends on it.

  • Install: python scripts/install.py --firecrawl runs cargo install firecrawl-local. It needs a Rust toolchain and a C compiler. --all tries it too when cargo exists (skip with --no-firecrawl). Without cargo, install Rust from https://rustup.rs and run cargo install firecrawl-local yourself.
  • Run: nothing to do. On the first fetch Terser starts firecrawl-local serve on 127.0.0.1:3002 with FIRECRAWL_CLOUD=off. Set web_fetch_firecrawl_autostart to false to start it yourself.
  • Local only: only loopback endpoints are accepted, proxies are bypassed, no API key is sent, and cloud-sourced or blocked results are discarded. A server you start yourself should also set FIRECRAWL_CLOUD=off, or Firecrawl may use its cloud for searches and blocked pages.
  • Opt out: set web_fetch_backend to urllib (or TERSER_WEB_FETCH_BACKEND=urllib). terse doctor shows the current state.

Bash for Code Mode

Code Mode runs Bash scripts with Bash by default. On Windows, install Git for Windows for Git Bash. Terser checks standard Git for Windows locations when bash is missing from PATH or resolves to the Windows WSL launcher. For POSIX-only scripts, request language: "sh" to use the host’s sh. Git for Windows

Set TERSER_BASH in the MCP server environment to use a specific interpreter.

Host-specific setup and compatibility
  • Antigravity installs in place and launches hooks without Windows console flashes. Open Terser HUD from the sidebar.
  • Claude Code supports claude plugin update terser@terser after pulling. For a one-session test, use claude --plugin-dir "/path/to/terser". The optional --statusline installer flag adds Terser’s status line if the slot is free.
  • Codex exposes registered hooks via /hooks in the CLI and Settings → Hooks in the desktop app. Its PostToolUse receives the original tool result. Use terse exec or the MCP actions for reduced output. codex_form_repair and codex_mcp_refetch_guard are opt-in.
  • opencode uses the V1 plugin API. It passes MCP results through and preserves ranged file reads. OPENCODE_CONFIG_DIR sets the config location.
  • Cursor supports read outlines, shell form repair, loop hints, and edit recovery. Shell output passes through unchanged. MCP output rewriting is opt-in through cursor_mcp_output_rewrite. CURSOR_HOME sets the config location.

Benchmarks

Context compression summary with 58,940 estimated tokens before, 3,216 after, and 55,724 saved across 11 workloads.

Horizontal bar chart of estimated token reductions across 11 workloads, ranging from 75.8% to 98.9%.

The 94.5% figure is the pooled reduction across 11 benchmark workloads. The suite estimates tokens using roughly four characters per token and uses a fixed schema-size comparison alongside local fixtures. Session savings vary with the host, model, and workload.

python scripts/benchmark.py --check
python scripts/benchmark.py --check --write-charts
python scripts/benchmark.py --native --write-charts

Native Rust vs Python latency

Native Rust vs Python median latency comparison across 5 hot-path workloads.

Measured locally on Windows comparing bin/terser-fast.exe and bin/terser-exec.exe against the built-in Python fallbacks (runtime/unified_hook.py, runtime/output_compressor.py, runtime/index_mcp.py):

Workload Python Rust Speedup
PreInvocation (per-turn hook) 582.5 ms 6.9 ms 84.6x
Repo scan & symbols (40 files) 180.3 ms 11.4 ms 15.8x
PreToolUse (subagent route) 128.5 ms 9.0 ms 14.3x
PreToolUse (run_command wrap) 126.3 ms 40.2 ms 3.1x
Exec & compress (git status) 164.9 ms 72.8 ms 2.3x
Exact workload totals and Codex measurements
Workload Before After Saved
MCP tool schemas 25,800 1,050 95.9%
Unchanged file re-read 3,603 38 98.9%
Small-edit delta 3,603 93 97.4%
Code outline 3,603 692 80.8%
Documentation outline 5,753 333 94.2%
Cargo build log 447 34 92.4%
Columnar JSON folding 1,751 205 88.3%
Repeated pytest run 505 122 75.8%
Archive search 5,678 462 91.9%
SmartCrusher JSON 4,342 115 97.4%
Git lockfile diff 3,855 72 98.1%
Pooled 58,940 3,216 94.5%

Run terse --host codex benchmark to check model-visible parity and p50/p95 hook time. Add --warm for persistent worker timings or --native PATH for a specific build. Use --codex-rollouts baseline.jsonl candidate.jsonl to compare reported uncached input, cache reads, cache writes, and output from runs on the same model. See benchmark source and regression baseline.

How it works

Layer What Terser does
Persistent code index A six-tool Counter MCP surface routes to AST lookup, source ranges, references, lexical search, winnow_symbols, and task-scoped context. Weighted channel fusion (WWR) with calibrated verdicts, refresh-on-read staleness checks, and optional #MUNCH/1 or GCX1 compact wire formats keep payloads minimal. Edit hooks batch dirty paths per checkout into a single SQLite transaction.
Read Funnel Hash dedup for unchanged files, exact unified or symbol deltas after edits, SimHash near-duplicate diffs, outline-first reads for large files, overlap trimming, and §ref:<sha12>:L<s-e>§ range references. Verified edit seeding advances the cache only after the on-disk result matches. Retrying a shortened read recovers the full file.
Output compression Host-aware inline byte budgets (8.8 KB Antigravity, 40 KB Claude), water-fill section budgeting, and 38/62 UTF-8 head/tail truncation. Combined stdout + stderr shell outputs, long-line Glob/Grep results, and oversized WebFetch responses (including error pages) are archived and capped below 20K chars. Tool-aware filters handle build/test noise, diffs, benign zero-counts, structured log noise, and repeated commands. SmartCrusher folds JSON/NDJSON losslessly, while a deterministic post-compression verifier and structured factsheets guard critical signals.
Searchable archive SQLite FTS5 stores oversized shell, MCP, search, and web output in ~/.terser/sandbox.db, with non-blocking hook spooling (pending/sandbox/) and 2-char/CJK fallback search. Retrieve an exact range or search the archive by terms.
Session continuity A static-first brief and deterministic PageRank repo map keep the prompt prefix stable. Compaction preserves recent decisions, @terser pin/unpin markers, and re-injection advisories, while terse resume-lean builds a restart brief from checkpoints and Git status.
Subagents and loop guard Compact subagent briefs, opt-in model routing with local citation checks, fail-closed offloadable-file classification, and a hybrid loop/thrash/heredoc guard (loop_guard_mode). Agents receive index-first instructions on supported hosts while the host retains tool permissions.

Code Mode and repository search

Use order from terser-index (or terse index <action> from shell/subagents) for operations that should return a small result to the model.

Action Use it for
run_script Run Python, Node, Bash, or PowerShell. Bash heredocs are passed as LF script files. Python includes local search, structured reads, and staged edits through t.
search_text Indexed literal search. Use regex, glob, or live for a live ripgrep search with bounded, line-numbered results when ripgrep is available. Recent or unverifiable files are read directly.
search_symbols, get_symbol_source, winnow_symbols, assemble_task_context Navigate a persistent repo index, prune low-signal symbols, and return source ranges or a token-budgeted selection. Supports optional #MUNCH/1 and GCX1 wire formats.
code_search, code_query, code_edit Combine patterns, extract values from structured files, or stage an all-or-nothing batch edit. code_query returns bounded pages for wildcard selections. Pass the reported offset to continue.
search_sandbox, expand_sandbox Search archived output or fetch a specific line range. Accepts archive_id: "--last" for the most recent archive.
execute_batch, fetch_and_index Run bounded local commands or fetch and index a URL. Batch failures preserve results from successful commands.

For compiler-precise references, import a SCIP index. Architecture and history actions include get_hotspots, get_blast_radius, get_pr_risk_profile, and get_layer_violations. Set per-repository indexing and analysis options in <repo>/.terser/config.toml. See the index action guide.

To explicitly index an installed Python dependency, use the index_python_dependency action with an absolute site_packages directory, installed distribution name, and top-level package name. It reads local distribution metadata without importing package code, reports the installed version and origin, and refuses editable installations and unowned source files. It does not verify installed files against hashes or compare them with a lockfile; shared namespace packages and binary-only packages are not supported. Index only installations you trust.

For an optional advisory retrieval budget, include session_id and session_retrieval_budget in each order action's args. The response reports estimated delivered text tokens and per-operation totals for that session in the current server process. This does not block results and is not provider-reported usage. Pass reset_retrieval_budget: true to start a fresh count; restarting the server also clears counts. The estimate excludes the advisory itself and other calls made without the option.

find_cross_repo_contracts compares declared routes in an indexed provider against literal Python requests/httpx calls and lexical JavaScript/TypeScript fetch calls in specified indexed consumers. Matches include source locations and are candidates, not proof of deployment identity; dynamic URLs and router prefixes are not resolved. Scans have a shared file budget and report truncation.

Use menu(query="...") for ranked action lookup or pass the exact action name for its arguments. Use menu(offset=0) to browse eight actions at a time.

preview_rename uses a global SCIP symbol and verifies source bytes and identifier ranges before returning edits. For indexes without embedded text, pass the exact compiler-input Git revision as source_ref to import_scip. Supply position_encoding at import only when the indexer omits it and you know which encoding it used. Supply stage_session to inspect the proposed text in an overlay. The preview covers occurrences supplied by the compiler index. Build and language-specific conflict checks are separate.

Batch work, inspect changes, and resume

Workflow Terser action
Search and read code_search_batch combines supported search operations. code_outline returns symbol boundaries and requested line ranges across files.
Verify edits Add verify profiles to code_edit, or run independent checks with run_checks. Each check reports its outcome and can link to archived output.
Fetch targeted context get_context_manifest and search_context find relevant ranges. fetch_context and recut_context return bounded pages with revisions and cursors for follow-up reads.
Inspect impact get_code_graph, get_test_impact, and get_symbol_coverage expose dependency and test evidence. find_structural_matches uses Python AST and installed tree-sitter grammars. get_framework_routes reports FastAPI and Flask declarations and Next.js and SvelteKit file-based routes.
Try alternate edits Use overlay_fork with a source overlay_session and new_session to copy editor buffers and their versions. Query the new session with get_file_outline or literal search_text, and use overlay_drop when finished. Forks are process-local and files without overlays are read from the checkout.

Session briefs can include a short list of changed files and project scripts. Terser discovers the scripts without running them. Workspace memory is enabled by default and stores bounded, redacted summaries of edits and errors with references to local events. Set memory=false to disable it. When memory is enabled, sourced records phrased as simple “topic requires topic” statements are linked automatically, and matching prompts receive a bounded advisory lookup. These historical records do not establish authority or permission; verify their sources and applicability. More complex relationships are not automatically inferred.

Automatic skill induction

Terser learns repository-specific guidance from completed sessions. Candidate guidance requires evidence from distinct sessions before it can appear in a session brief. Hosts with a model runner can make background proposer calls.

Antigravity 2.0 can learn recurring verification commands locally, such as cargo test, from successful shell results. When a conversation starts, Terser processes quiet conversations from that repository in the background. Subsequent conversations can receive the learned guidance.

Setting Behavior
terse config set microskills=on Default. Learn environment facts and induce skills from session evidence.
terse config set microskills=envfacts Learn environment facts only.
terse config set microskills=off Disable learning and injection.

Run terse microskills to inspect learned guidance.

Use terse benchmark-workflow --help to compare two Antigravity runs with verified task outcomes. The comparison reports model turns, tool activity, cache usage when available, and elapsed time.

Native hooks and faster local I/O

  • Rust dispatch & dual binaries. terser-fast (GUI-subsystem on Windows for zero console flashes) handles eligible read-funnel, output-compression, loop-guard, Antigravity PreInvocation, PreToolUse (run_command wrapping and subagent/swarm complexity routing), PostToolUse (exit_plan_mode), and lifecycle events, delegating combined or post-fold payloads over 16 KB to Python archival. terser-exec (console-subsystem on Windows) runs wrapped shell commands synchronously with full stdout, stderr, and exit-code fidelity, enforces host-aware inline budgets while archiving/windowing oversized stderr on both zero and non-zero exits, and accelerates multi-language repo scanning (scan-index) inside index_mcp.py. Native JSON and NDJSON folding covers supported payloads up to 512 KB (up to 512 NDJSON rows), including nested envelopes, with UTF-8 safe byte-slice redaction. Fast no-op gates skip Python where possible, and a warm Python worker handles delegated cases. Codex’s fast paths preserve the original tool result and return hook metadata.
  • Zero-command Antigravity 2.0 automation. Plain-language Terser and archived-output requests (intent_hint) trigger automatically on any turn, task_index_hint resolves backticked, snake_case, and CamelCase identifiers to exact file:line index anchors before grep, and generated rules (AGENTS.md/GEMINI.md) route archive queries directly to MCP order(action="search_sandbox", ...).
  • Lower index overhead. Windows batches file metadata checks and prefetches cold-index reads. Incremental refreshes preserve concurrent edit updates and reuse unchanged rows.
  • Bounded Codex runner. terse exec --sid <id> -- <cmd...> preserves stderr and exit status. Native capture pairs with Python verification for archive-backed deltas. Recover the underlying stdout with terse expand <id> --raw.
  • Local failure diagnostics. terse failures [N] shows the host, session, tool, failure category, and exit code when available. Diagnostic records exclude command text and output.
Other integrations and workflow controls
  • Any stdio MCP server. Wrap it with terse mcp-proxy -- <cmd...>. The default retains full tool declarations and individual names. Use --eager-tools to expose individual tools with compact schemas that preserve validation literals and references, or --lazy-tools to shorten descriptions with on-demand help. --no-desc also keeps declarations intact.

Deferred MCP tool discovery

Deferred discovery is available with terse mcp-proxy --defer-tools -- <command> [args...]. The default exposes individual upstream tools so hosts can apply per-tool approvals. In deferred mode the proxy advertises two stable tools, reads the upstream catalog on the first search, caches it for the connection, and refreshes after a tools/list_changed notification.

An incomplete discovery returns a timeout error after 30 seconds and discards late pages. The timeout does not cancel the upstream request. If the server stops reading its input and the transport pipe fills, the proxy's forwarding thread can still block; reconnecting or restarting the proxy may be necessary. Do not assume an interrupted upstream operation was rolled back.

  1. Call terser_tool_search with {"query":"inventory item"}. It returns a short list of matches, or the complete declaration for a unique match. Call with {"tool":"readItems"} for the exact declaration.
  2. Call terser_tool_call with {"tool":"readItems","arguments":{"id":7},"select":"/items/0/id"}. The optional JSON Pointer selects a value locally from a JSON result. A successful smaller projection includes an archive recovery hint after the full result has been stored and verified. Errors, mixed content, unresolved pointers, and archive failures return the original result. Omit select to request the complete result through the usual output pipeline.

For a plain JSON array of objects, use transform instead of select, for example {"tool":"listItems","arguments":{},"transform":{"filter":{"field":"status","equals":"open"},"offset":0,"limit":10,"fields":["id","status"]}}. The filter uses exact type-sensitive equality; pagination and field selection run after filtering. Set count to true to return the filtered count instead. Transforms accept at most 10,000 rows and 2 MB of JSON text; unsupported, diagnostic, sensitive, multimodal, or unrecoverable responses remain unchanged. The complete original is archived and verified before a smaller result and recovery hint are returned. This local reduction does not provide per-tool authorization or an isolated execution environment.

Client approvals in deferred mode apply to the two wrapper tools, not individual upstream calls. The default broker policy requires an explicit matching allow rule for each upstream operation; unmatched operations are refused. Rules and optional policy modes are local authorization, not host per-tool approval. Modes that trust tool annotations rely on unverified upstream hints, and off permits all calls. Use --eager-tools, --lazy-tools, or --no-desc for hosts that need individual tool approvals, MCP Apps, or always-visible tool names.

Capability Current behavior and limits
Tool discovery The default keeps full declarations and individual tool names. Deferred discovery is explicit; its catalog is refreshed on upstream notifications.
Per-tool approvals Individual names let a host apply its usual per-tool rules. Deferred calls use the wrapper's approval; use the default when individual approvals are required.
MCP Apps and multimodal results Use individual tool exposure for MCP Apps. Errors, metadata, and mixed or non-text content are retained when projection is unsafe; host rendering still depends on the client.
Local code execution Code mode runs with the local user's permissions and is not an isolation boundary. Only run trusted programs and grant access accordingly.
Provider-native retrieval and caching The proxy does not own the host's model requests and cannot activate provider request features. The provider capabilities below describe options for a client that owns those requests, not Terser adapters.
Benchmarks Local fixture estimates, supplied outcome metrics, and provider-reported usage measure different things. Compare matched workloads and do not infer actual billing or task success from token estimates alone.
Provider integration Where the savings apply
Claude Claude's Messages API supports native tool search and programmatic tool calls that keep intermediate results in the execution container. The stdio proxy provides discovery and local JSON selection to MCP clients independently of those API settings. Tool search · Programmatic tool calling
Gemini Interactions API clients can use native deferred schemas and preserve a stable tool and instruction prefix for implicit caching. For uploaded PDFs, spreadsheets, audio, and video, use Gemini's Files API slicing when the client owns the request. Tool retrieval · Context caching · File slicing
Codex SDK Reuse or resume the SDK thread and send the next task. The proxy works through the Codex client's stdio MCP configuration. Inspect turn.completed usage in a streamed run to measure a specific workflow. Codex SDK
Cloudflare Cloudflare's search and execute pattern inspired the fixed tool surface. Terser's wrapper forwards named calls and evaluates JSON pointers locally. Code Mode
  • Multi-host rules and Gemini CLI extension. Generate synchronized rules (AGENTS.md, GEMINI.md, Cursor, Windsurf, Cline, Copilot, Kiro) with python scripts/build_rules.py. The Gemini CLI extension loads rules/GEMINI.md and registers the six-tool index over stdio. Gemini CLI extensions
  • Custom output filters. Define [[filter]] rules and command exclusions in command-filters.toml. Test the rules with terse filters test "<cmd>".
  • Context exclusions. Use gitignore-style .contextignore rules for context reads and indexing.
  • YouTube transcripts. terse youtube uses local yt-dlp to extract captions, then compacts and indexes them for retrieval.
  • Routing controls. terse routing status lists configured models. Claude Code routes to supported tiers such as Haiku, Sonnet, Opus, and Fable. Antigravity uses flash_lite, flash, and pro for subagents. Its conversation-picker models depend on the plan. Claude subagents · Antigravity models

Live HUD and analytics

Surface Open it What you can see
Antigravity sidebar Terser HUD in the side pane Savings, context fill, estimated cost, quality, activity, routing, and settings
Claude Code HUD Ships inside the terser plugin (registered via modules in hooks/hooks.json); no separate install. Needs the Claude desktop app with mods enabled Prompt status band and a details pane for Overview, Quality, and Settings. HUD setup
Claude Code status line python scripts/install.py --statusline Compact status and usage in Claude Code’s status-line slot
Codex terminal HUD terse --host codex hud --watch Session savings, model, context fill, and estimated cost. Add --session <id> to select a session, or use hud --json for a snapshot.
Local dashboard terse dashboard HTML analytics for savings, tool usage, and session quality

HUD updates reuse verified transcript and savings checkpoints and rebuild when a log changes or rotates. Live views surface cache-warmth countdowns, urgent-action alerts, cache-miss attribution, 1h cache-write pricing, and multi-host vendor traces. Session savings come from attributed events, and retained totals include unattributed historical events. Dollar figures use a dated catalog of published standard API rates. Your subscription and billing depend on the host and plan. Claude pricing · Google API pricing · OpenAI API pricing

CLI reference

Use scripts/terse on macOS or Linux, scripts\terse.cmd on Windows, or python runtime/cli.py. Put --host <host> before the command to select a host.

Command Purpose
terse status · terse savings · terse grade Health, per-layer savings, and session quality
terse hud --json · terse dashboard HUD snapshot or local HTML dashboard
terse audit [--days N] · terse audit --deterministic-candidates Token-waste audit and recurring commands to offload to scripts
terse discover --replay · terse holdout [--verify] · terse audit --turns Transcript replay, deterministic 10% holdout A/B with bootstrap CI verification (--verify), and turn-count ($N$) billed-cost & serial-turn coaching (--turns)
terse audit-config · terse security-report Workspace configuration, cache-prefix, and secret-exposure audit
terse doctor Check installation and configured features, and report known host limitations. Configuration does not prove hooks are being delivered.
terse doctor · terse failures [N] · terse probe Install health, recorded tool failures, and environment probe
terse index <action> [args] Invoke Counter MCP index actions from shell or subagents
terse query --last "<terms>" · terse expand --last Search or retrieve archived output
terse batch --spec <file|-> [--session ID] [--timeout N] [--allow-all] Run up to 20 argv-only commands (no shell), check each individually (denied unless --allow-all), archive each output with status and provenance, and optionally query/select/expand. See docs/archive-privacy.md.
terse search-archives "<terms>" [--session ID] [--source COMMAND] [--limit N] [--cursor CURSOR] Search indexed archive occurrences in the current workspace; JSON includes source, session, excerpts and continuation
terse repomap --budget 400 Build a compact structural map of the checkout
terse route "<task>" · terse routing status Inspect task complexity and routing
terse exec --sid <id> -- <cmd...> Run a bounded command with archive-backed deltas
terse benchmark · terse --host codex benchmark Reproduce savings or measure Codex hooks
python scripts/benchmark_integrity.py Run synthetic offline checks for diagnostic retention, archive recovery, and redaction (not an end-to-end agent benchmark).
python scripts/benchmark_task_outcomes.py Compare supplied functional and security checks across two workspaces; see task outcome benchmark for provenance and measurement limits.
python scripts/benchmark_image_context.py Evaluate supplied text and image-context recall results offline; see image-context evaluation.
terse benchmark-workflow --help Compare Antigravity workflow runs with verified outcomes
terse memory add/search/show/timeline/edit/delete/export/repair Manage sanitized memory for the current workspace. Search returns compact previews. Use timeline <id> for nearby records and show <id> [id ...] for full text and evidence. Use search --full for full search results. search --estimate-expansion and timeline <id> --estimate-expansion report approximate per-record and batched detail costs based on serialized JSON bytes, not provider token counts; estimates can change when records change.
terse memory dependency <id> <topic> <requires> · terse memory governing <topic> --depth 2 Associate an explicit dependency with an evidence memory and retrieve bounded, advisory topic claims. Results report conflicts, missing topics and incomplete traversal. Deleting the evidence memory removes its links. Source authority, applicability and authorization remain unverified; use terse memory show <id> to inspect the underlying record.
terse memory provenance · terse memory claim · terse memory conflicts · terse memory prune Attach workspace-scoped evidence and explicit claims, review conflicting values, and preview or apply age-based retention. Conflict review is advisory.
terse dashboard --memory Generate the local workspace memory viewer
terse config show · terse microskills · terse toolprune Inspect settings, learned environment facts, and tool pruning

Claude Code also has /terser:status, /terser:audit, /terser:dashboard, /terser:doctor, /terser:tune, and /terser:routing.

Configuration

Use terse config show to see effective settings, terse config set <key>=<value> to change them, or terse config reset to restore defaults. Environment overrides are read by hooks and the MCP server.

Setting Effect
TERSER_HOME Change the state directory from ~/.terser
TERSER_DISABLE=1 · TERSER_SHADOW=1 Disable hooks or log hook decisions without rewriting calls
TERSER_BASH Override the Code Mode shell with an executable name or absolute path. Defaults to Bash for Bash scripts.
TERSER_PYTHON · TERSER_PYTHON_WORKER=0 Choose Python or disable the warm hook worker
TERSER_INDEX_WORKERS=N · TERSER_DISABLE_TREE_SITTER=1 Set indexing parallelism or force the regex extractor
TERSER_CPU_PSI_GATE=0 Disable the Linux CPU-pressure gate for Terser-owned index workers and native installer builds

| TERSER_AUTO_INDEX=0 · TERSER_AUTO_REINDEX=0 | Disable automatic repo indexing or edit-triggered refresh | | TERSER_OUTLINE_FIRST=0 · TERSER_BASH_COMPRESS=0 | Disable outline-first reads or shell-output compression | | TERSER_INTENT_HINTS=0 · TERSER_LOOP_GUARD=0 | Disable prompt-time hints or loop intervention | | TERSER_LOOP_GUARD_MODE | Select loop guard mode: hybrid (default), native, or economizer | | TERSER_CODE_MODE=0 | Disable local Code Mode script and batch actions | | TERSER_WORKSPACE_SNAPSHOT=0 | Omit the changed-file and project-script snapshot from session briefs | | TERSER_MEMORY=0 | Disable automatic workspace memory capture and recall |

On Linux, Terser samples CPU PSI some avg10 when starting its own native build or parallel indexing. Above 40%, it uses one worker; the next job samples again. The Rust probe is preferred when installed; a Python bootstrap reads PSI for the first native build or if the probe is unavailable. Missing PSI and other operating systems retain normal concurrency. Explicit CARGO_BUILD_JOBS is respected.

Additional controls
Config key Effect
symbol_delta · edit_miss_hints Whole-symbol delta reads and closest-match hints for failed edits
index_grep_answer · search_repeat_elision Reuse indexed previews and skip repeated search results
compact_recall · fanout_checkpoint Recall recent decisions after compaction and checkpoint before spawning agents
health_check · context_fill_nudges · session_summary Startup checks, context-fill nudges, and end-of-turn savings summaries
web_archive · contextignore Web output archiving and context exclusions
web_fetch_backend · web_fetch_firecrawl_url · web_fetch_firecrawl_autostart Optional loopback Firecrawl Local backend for fetch_and_index (auto or urllib)
json_lossy Opt-in JSON pruning, with the source payload archived when available

Terser stores indexes, archives, and metrics locally. Explicit URL and transcript actions can access the network. Installer downloads run during setup. Hooks fail open if an optimization encounters an error. Archived output is redacted before indexing. Local scripts run with the permissions of the MCP process. See failure modes and safety invariants.

Set sensitive_persistence_guard=true in Terser configuration or TERSER_SENSITIVE_PERSISTENCE_GUARD=1 to skip recognized secrets, private markers, Python tracebacks, and SQL DDL in supported Python archive, background job, read-cache, and error-log writes. Guarded output passed through compress_output remains unchanged, and Python-generated command wrapping is disabled. This is a scoped, pattern-based safeguard, not a global no-persistence guarantee: native writers, memory and other storage paths, unrecognized secrets, separately submitted chunks, and data written before activation are not covered.

Development, testing, and release bundles
python -m unittest discover -s tests -v
cargo test --manifest-path native/terser-fast/Cargo.toml
python scripts/benchmark.py --check --write-charts
python scripts/install.py --build-native --antigravity
python scripts/install.py --bump patch --build-dist

License

Terser is licensed under the GNU General Public License v3.0. The bundled TokenEconomizer code retains its MIT license. See third-party notices.

Archive cross-session search indexes only outputs recorded with known workspace provenance. Older archives and raw sidecars remain available by ID but are excluded from this search. Scope uses the recorded project directory or process working directory and is a local filter, not an operating-system access boundary. Results are bounded; a changed archive snapshot invalidates a continuation cursor, and scan_truncated signals the 1,000-occurrence scan limit. Use terse expand <archive-id> for full retained content.

HUD, doctor and installer-safety details: docs/hud.md, docs/doctor.md.

Memory extensions (file-scoped memory, history/restore, consolidation, paging, hybrid retrieval interface): see docs/memory.md.

Archive ownership, private-region handling, scoped archive search, archive_batch, and the fetch destination policy are described in docs/archive-privacy.md.

About

Lossless context compression & token-efficiency engine for AI coding agents (Antigravity 2.0, Claude Code, Codex). 94% measured savings, 14× faster Rust hot-path with pure-Python fallback.

Topics

Resources

Stars

4 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages