opencode-dejavu AGENTS.md

A set of instructions for Dejavu, an OpenCode plugin that remembers repeated tool-call failures and can block the same mistake after it happens repeatedly. OpenCode is a coding-agent environment, and Bun runs its TypeScript files.

In plain words
What is it for?
Use it when working on the plugin’s failure detection, stored rules, validation, repair scripts, commands, or smoke test.
Why use it?
It helps prevent recurring tool errors from being repeated across coding sessions.

Instructions file for CodexOpenCode

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add instructions/whitebite/opencode-dejavu/agents-md
Clone the repo
git clone --depth 1 https://github.com/WhiteBite/opencode-dejavu

Made for: Codex, OpenCode.

Per session 3,465 This file is loaded in full into every session.
When invoked 3,465 The same file — it is already loaded in full.
Security scan A 1 finding. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.03465 $0.03465
Opus 5 $0.01733 $0.01733
Sonnet 5 $0.00693 $0.00693
Haiku 4.5 $0.00347 $0.00347

Measured yesterday against content hash 3cc561845bce, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

opencode-dejavu AGENTS.md scanned grade A with 1 finding against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured yesterday.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Makes network callslowCapability

Not a fault in itself. Listed so you know the mod talks to something, and to what.

- Do NOT count exit 1 from diagnostic verbs (grep/tsc/pytest/curl/ls...) as failure — intended outcome; exit ≥ 2 always counts (OpenCode normalizes exits to 1, so discriminate by command shape)
AGENTS.md · 134 lines

How it starts

The opening of the file, as written. The whole thing — 134 lines — stays where its author put it; the contents beside it link to each section on GitHub.

PROJECT KNOWLEDGE BASE

Generated: 2026-08-22 (refreshed 2026-08-30) Commit: 14ca0c1+ Branch: main

OVERVIEW

dejavu — OpenCode plugin ("memory prosthesis with teeth"): mechanically detects recurring tool-call failures and promotes them into enforced gates (3 failures across 2 distinct sessions). Remind first, hard-block on same-session repeat offense. TypeScript ESM, runs under Bun, ships as raw .ts (no build step).

STRUCTURE

dejavu-opencode-plugin/
├── index.ts            # Plugin entry — exports Dejavu (Plugin factory) + all 4 hooks
├── src/
│   ├── patterns.ts     # Pure engine: signatures, normalization, secret scrub, detection, blocking policy
│   ├── store.ts        # GateStore/Stores: two-scope persistence, locks, promotion, TTL, migration, reconcile
│   └── validate.ts     # Invariant layer: strict gate parsing + mechanical repair (parse-don't-validate boundary)
├── test/smoke.ts       # Behavioral smoke test — plain bun script, no framework, temp-dir isolated
├── scripts/            # doctor.ts (pathology report), analyze.ts (store summary), migrate.ts (demote+scrub)
├── command/dejavu.md   # /dejavu slash-command definition (install → ~/.config/opencode/command/)
├── skills/dejavu/      # Companion agent-protocol skill (install → ~/.config/opencode/skills/)
└── .omo/, .codegraph/  # Tooling artifacts — not project code

WHERE TO LOOK

Task Location Notes
Gate enforcement (remind/block/override) index.ts tool.execute.before session state lives ON THE GATE (remindedSessions/failedSessions), read fresh under the store lock
Failure detection + recording index.ts tool.execute.after + event two channels: exit/text vs message stream; a cross-channel dedup guard counts one call once
Signature/normalization src/patterns.ts callSignature, normalizeCommand, parameterizeError
Enforcement policy src/patterns.ts:canBlock()/canRemind() three tiers — bash non-diagnostics block, diagnostics remind-only, everything else just watches
Persistence, locks, promotion, global escalation src/store.ts Stores.recordFailure() is the core; cross-project evidence lives in global index.json
Self-healing / reconcile src/store.ts + src/validate.ts Stores.reconcileAll() at every init; doctor --repair on demand
Tunables top of index.ts and src/store.ts split: TTL/review caps in index, promote thresholds in store
Pathology checks scripts/doctor.ts defect classes: unparseable/bad records, duplicate keys, temporal inversion, nested tokens, enforced-without-evidence, stale blocking/reminding, not-teaching, annoying, review-flagged, reminders-ignored, unsanitized, stale copies, corrupt logs, version drift, cross-store index checks; no-arg run discovers projects from the index

Read the full file on GitHub · 134 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. yesterday First seen · 134 lines · 3,465 tokens per session scan A 3cc561845bce

Subscribe to this mod's changes

opencode-dejavu AGENTS.md is an instructions file published in the GitHub repository WhiteBite/opencode-dejavu (5 stars, last pushed 2d ago), licensed MIT. It adds 3,465 tokens to every session, about $0.0173 per session on Opus 5. A static security scan graded it A with 1 finding (makes network calls). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.