metacogs
v0.4.1
Published
Explicit, testable reasoning methods as portable Agent Skills, and an OpenCode plugin that adds two tools and four skills
Readme
metacogs
Explicit, testable reasoning methods packaged as portable Agent Skills. Each method is a short written procedure plus a helper that validates and stores a decision record. A method is included only after an eval shows it changes what a model does on tasks where it should apply, and stays silent on tasks where it should not. The package is also an OpenCode plugin, a Claude Code plugin and an experimental Codex plugin.
Stance
Altered cognition and jailbreak framing are not objectives of this project. It reinterprets the concepts from inanna-malick/metacog as ordinary, inspectable procedures: a structured choice, then a response that redirects work. A method structures the model's own reasoning; nothing in it enforces anything. Upstream attribution is in Attribution.
The OpenCode plugin keeps upstream's tool names, including drugs. Here drugs is a handle for a deliberate change of approach: the model names a substance as a short label and says what it will do differently on the next attempt. It does not change the model, adds no capability, and nothing in this project claims it improves results. feel is a pause on an unnamed tension. Neither supplies facts or checks anything.
Install
Copy a skill directory to a path your host scans:
mkdir -p .agents/skills
cp -R <metacogs-clone>/skills/synthesis .agents/skills/synthesis
cp -R <metacogs-clone>/skills/counterfactual .agents/skills/counterfactual.agents/skills/ works for OpenCode, Pi, and Codex. Claude Code reads .claude/skills/ only. Per-host paths, listing commands, and the smoke evidence are in docs/install.md.
- Helper runtime. The record helper is one dependency-free file that needs Node 22 or newer. The agent runs it with
node; no install step. The Claude Code and Codex plugins write records through arecordtool instead, and ship no helper. - Records. Records go to
$XDG_STATE_HOME/metacogs/records/(default~/.local/state/metacogs/records/), outside your repository.METACOGS_RECORDS_DIRor--out-diroverrides it. To keep records in a project, opt in withMETACOGS_RECORDS_DIR=.metacogs/recordsand add.metacogs/records/to.gitignore. unrecorded. If the helper cannot run (no Node 22, a denied shell command, an unwritable directory), the skill says no record was written and the run is markedunrecorded. It never claims a record that does not exist.
OpenCode plugin
metacogs is also an OpenCode plugin. It adds:
- Two tools,
feelanddrugs. Their descriptions and return text are adapted from upstream.feelpauses on a tension that has no name yet.drugsstates a deliberate change of approach for the next attempt. Neither supplies facts, checks anything, or guarantees a result. - Four skills:
feel,drugs,synthesisandcounterfactual. Typed/feeland/drugsrun the first two, with or without arguments (/drugs caffeine). On OpenCode v2 all four skills are slash commands. Thefeelanddrugsskills have the same names as the tools but are separate: a skill is instructions the model loads, and a tool is what it calls. The skills say when to call each tool and how to fill its fields, and/feelloads the skill, which then has the model call the tool.synthesisandcounterfactualare the methods described below; the plugin loads them from the package, so no copy under.agents/skills/is needed. - A guidance block of a few lines in the system prompt of normal requests (not the host's title and summary calls). It names the tools and skills and the situations each one fits, and does not require their use. To keep the tools and skills and drop the block:
{ "plugin": [["metacogs", { "guidance": false }]] }On OpenCode v2 the same option is { "plugins": [{ "package": "metacogs", "options": { "guidance": false } }] }.
Plugin install
Add the package to plugin in opencode.json (project) or ~/.config/opencode/opencode.json (user):
{ "plugin": ["metacogs"] }OpenCode v2 reads a plugins key instead:
{ "plugins": [{ "package": "metacogs" }] }OpenCode installs the package on the next start. The supported versions are OpenCode 1.19.4 and later 1.x, and 2.2.0 and later 2.x; older versions are unsupported. It is tested on OpenCode 1.19.4, and CI runs the contract suite on the OpenCode v2 CLI pinned in package.json (testedWith).
On OpenCode v1, typed /feel and /drugs run the skills, but the TUI / popup lists only commands that are not skills. On v2, multi-word arguments arrive as typed, unquoted. A skill denied by permissions is still delivered when typed as a slash command; the permissions array form is in docs/install.md.
If you copied synthesis or counterfactual into .agents/skills/ or another scanned path, remove those copies. The plugin provides the same skill names, and OpenCode does not guarantee which of two same-named skills wins. The method skills still write their records as described under Install above.
Where it comes from
feel and drugs are the tools from inanna-malick/metacog. Their descriptions and return text are adapted from upstream at the pinned commit, with the claims about changing how the model processes removed (see Attribution); the skill text around them is this project's. synthesis and counterfactual carry the evals under Evidence. The tools and the feel and drugs skills have no eval of that kind.
Model notes
Observed on OpenCode 1.19.4 with GPT-6 Luna, GPT-6.1 Sol, Claude Haiku 5.5 and Claude Opus 5.5. The samples are small and these are observations, not measurements.
- Models rarely call the
feelordrugstools on their own. /feeland/drugsreliably lead to the tools being called. In 32 of 32 runs across the four models, the command was followed by a tool call. Those runs used an earlier form of the commands; the skill form was checked on GPT-6 Luna and Claude Opus 5.5.- At a stuck point, such as a requirement that conflicts with a test or a platform limit, models tend to reach for
counterfactualfirst. In four such sessions on GPT-6 Luna and Claude Opus 5.5, each loadedcounterfactualand none called a tool unprompted.
How the plugin was tested is recorded in evals/spikes/feel-drugs/README.md.
Claude Code plugin
metacogs is also a Claude Code plugin, served from this repository. It adds the feel and drugs tools and a record tool through a local MCP server, the four skills, and a short factual note at session start.
/plugin install metacogs --marketplace marcusrbrown/metacogsThat one-step form needs Claude Code 2.1.275 or later. The two-step form is /plugin marketplace add marcusrbrown/metacogs, then /plugin install metacogs@metacogs.
- Node. Node 22 or newer must be on
PATH. Without it the session-start hook fails withnode: command not foundand the MCP server does not start, so the skills continue in plain text and a method run isunrecorded. - Invoke.
/metacogs:feel,/metacogs:drugs,/metacogs:synthesis,/metacogs:counterfactual. The tools aremcp__plugin_metacogs_metacogs__feel,mcp__plugin_metacogs_metacogs__drugsandmcp__plugin_metacogs_metacogs__record. - Records.
synthesisandcounterfactualcall therecordtool. Allow it with the rulemcp__plugin_metacogs_metacogs__record; the wildcardmcp__plugin_metacogs_metacogs__*allows all three tools. Records go to$XDG_STATE_HOME/metacogs/records/or~/.local/state/metacogs/records/, andMETACOGS_RECORDS_DIRoverrides it. - Session-start note. Set
METACOGS_GUIDANCE=off, create${XDG_CONFIG_HOME:-~/.config}/metacogs/guidance-off, or turn off the plugin'sguidanceoption. - Status.
verified. The package passesclaude plugin validate --strict. Checked by hand on 2026-10-28 in an interactive Claude Code 2.1.312 session: install from the marketplace,/mcp, the session note and theguidanceoption,/metacogs:feeland/metacogs:drugs, recording through therecordtool with no Bash prompt, and uninstall. Also checked in scripted headless runs (claude -p, Claude Code 2.1.312). Itssynthesisandcounterfactualskills are adapted for the host and are not the exact text that was evaluated.
Approvals, records, updates and uninstall are in docs/install.md. Updates follow the plugin manifest version, which changes with each release.
Codex plugin
metacogs is also an experimental Codex plugin, served from this repository. It adds the same tools (feel, drugs and record) and skills. It has no session-start note.
codex plugin marketplace add marcusrbrown/metacogs
codex plugin add metacogs@metacogs- Node. Node 22 or newer must be on
PATH. Without it the MCP server does not start, the skills continue in plain text and a method run isunrecorded. - Invoke.
$metacogs:feel,$metacogs:drugs,$metacogs:synthesis,$metacogs:counterfactual, with any arguments as text after the mention. A bare$feelis not a mention. The tools aremcp__metacogs__feel,mcp__metacogs__drugsandmcp__metacogs__record. - Records.
synthesisandcounterfactualcall therecordtool. The MCP server runs outside the shell sandbox, so records are written underread-onlyandworkspace-writealike. In the tested configuration they go to~/.local/state/metacogs/records/. - Session-start note. None. Codex discards the hooks of a plugin in the agent-plugins format, so the tools and skills work without a note.
METACOGS_GUIDANCEand theguidance-offfile apply to the Claude Code plugin only. - Status.
verified, and experimental. The manifests validate against the agent-plugins.org 1.0.0 schemas. Checked by hand on 2026-10-28 in the Codex 0.165.0 TUI:marketplace addandplugin add, the four skills in the$metacogs:picker,/mcp,$metacogs:feeland$metacogs:drugs, recording through therecordtool with no prompt, andplugin remove. Also checked in scriptedcodex execruns (Codex 0.162.1), including recording underworkspace-writeandread-only. Itssynthesisandcounterfactualskills are adapted for the host and are not the exact text that was evaluated.
Approvals, records, updates and uninstall are in docs/install.md. Codex refreshes an installed plugin only when the manifest version changes, which happens with each release.
Methods
synthesis
Use when several analyses, reviews, votes, or proposals disagree or converge on a decision. The agent restates each perspective in its own terms, finds the premises they share, names the concrete path that ties them together, and concludes no more strongly than what survives. Agreement that rests on one source counts once.
The record holds objective, evidence[], assumptions[], alternatives[], findings[], next_action, reopen_condition, execution_mode (direct, sequential, delegated, or unrecorded), and status, plus schema_version, helper_version, method, and method_version. A malformed record is rejected with the name of the field and nothing is written.
counterfactual
Use when a decision rests on an assumption that could be wrong. The agent finds the one premise the decision depends on, states what changes if it is false, and names the evidence that would flip the decision and where to get it. The record uses the same helper and fields as synthesis.
Without the skill, a model fails the preregistered rubric on 5 of 6 dev fixtures. In the epoch-5 read the dev campaign passed the preregistered pooled bar (29 of 30, 0 of 15 negative false fires). The one-shot held-out read scored skill 18/20 against baseline 1/20, delta +0.85 (95% interval 0.58 to 0.93), with 0 of 15 false fires on negative fixtures. Both skill-condition misses are judge_error results, not judge fail verdicts. Human review: 38/38 held-out judgments reviewed; CF2–CF4 above the 0.8 agreement floor; CF1 and CF5 below floor and demoted to advisory; recomputed verdict green. Three run outcomes flipped on review, giving a recomputed skill 17/20 against baseline 0/20.
The dev bar changed from a per-fixture 4 of 5 to a pooled 24 of 30 in epoch 5, after the dev results of epochs 2 to 4 were seen. It is declared in the epoch-5 prereg before any epoch-5 run, but it was chosen with that data in view. The epoch-5 held-out set is burned; any edit to the skill voids the read.
The other nine upstream concepts are listed in HYPOTHESES.md with one-line interpretations. None of them has an evaluated method skill. feel and drugs ship as plugin tools and skills (see OpenCode plugin) without eval fixtures, and a spike skill for them lives under evals/spikes/feel-drugs/. tether has two dev fixtures from a pilot that closed as not-reproduced, and no skill. The remaining six (become, name, ritual, deconstruct, fork, measure) were dropped, rejected or excluded, and have neither.
Host matrix
| Host | Project skills path | synthesis | counterfactual |
| --- | --- | --- | --- |
| OpenCode | .agents/skills/ | verifiedOpenCode 1.19.4 · model openai/gpt-6-luna · judge anthropic/claude-haiku-5-5 · 2026-10-23 · evidenceHuman review: 39/39 held-out judgments reviewed; SY1 above the 0.8 agreement floor; SY2–SY5 below floor and demoted to advisory; recomputed verdict green. | verifiedOpenCode 1.19.4 · model openai/gpt-6-luna · judge anthropic/claude-haiku-5-5 · 2026-10-23 · evidenceHuman review: 38/38 held-out judgments reviewed; CF2–CF4 above the 0.8 agreement floor; CF1 and CF5 below floor and demoted to advisory; recomputed verdict green. |
| OpenCode (v2) | .agents/skills/ | unverified2026-10-30No v2 eval report exists. | unverified2026-10-30No v2 eval report exists. |
| Pi | .agents/skills/ | content-compatible-untestedPi 1.3.0 · 2026-10-23 · evidenceListing smoke only. Project skills load after trusting the project (--approve). | content-compatible-untestedPi 1.3.0 · 2026-10-23 · evidenceListing smoke ran on synthesis only; counterfactual was not listed on this host. Project skills load after trusting the project (--approve). |
| Codex | .agents/skills/ | content-compatible-untestedCodex 0.162.1 · 2026-10-23 · evidenceListing smoke only. | content-compatible-untestedCodex 0.162.1 · 2026-10-23 · evidenceListing smoke ran on synthesis only; counterfactual was not listed on this host. |
| Claude Code | .claude/skills/ | content-compatible-untestedClaude Code 2.1.270 · 2026-10-23 · evidenceListing smoke only. Reads .claude/skills/, not .agents/skills/. | content-compatible-untestedClaude Code 2.1.270 · 2026-10-23 · evidenceListing smoke ran on synthesis only; counterfactual was not listed on this host. Reads .claude/skills/, not .agents/skills/. |
| Host | Plugin package |
| --- | --- |
| OpenCode | verifiedOpenCode 1.19.4 · 2026-10-26 · evidenceTested on the pinned OpenCode release with the packed package: scripted-provider integration suite, host probes and guided reads. |
| OpenCode (v2) | unverifiedOpenCode (v2) 2.2.2 · 2026-10-30 · evidenceThe contract suite passed on OpenCode v2 2.2.2 with the scripted provider on this date; CI keeps running it on the current pin. |
| Claude Code | verifiedClaude Code 2.1.312 · 2026-10-28 · evidenceManual run: Checked by hand on 2026-10-28 in an interactive Claude Code 2.1.312 session (Sonnet 5.5) with metacogs 0.3.0 installed from the marketplace. Checked: install, /mcp showing the server connected, the session note quoted in full, the guidance option turning the note off, /metacogs:feel and /metacogs:drugs caffeine calling the tools with the right arguments, /metacogs:counterfactual writing a record through the record tool with no Bash prompt, and uninstall leaving the records in place.Also checked in scripted headless runs (claude -p, Claude Code 2.1.312), and claude plugin validate --strict passes on the marketplace and the plugin. The synthesis and counterfactual renders are host-adapted, not the text that was evaluated. |
| Codex | verified (experimental)Codex 0.165.0 · 2026-10-28 · evidenceManual run: Checked by hand on 2026-10-28 in the Codex 0.165.0 TUI (GPT-6-Astra) with metacogs 0.3.0. Checked: codex plugin marketplace add and codex plugin add, the four skills in the $metacogs: picker, /mcp showing the metacogs server connected with three tools, $metacogs:feel and $metacogs:drugs caffeine, no session note as expected, $metacogs:counterfactual writing a record through the record tool with no prompt, and codex plugin remove leaving the records in place.Also checked in scripted codex exec runs (Codex 0.162.1). The manifests validate against the agent-plugins.org 1.0.0 schemas; Codex has no CLI validator. The synthesis and counterfactual renders are host-adapted, not the text that was evaluated. |
matrix.json is the source of truth and bun run matrix:check fails if this table drifts from it. The second table records each host's plugin package. "Pending human review" means the eval report is machine-green and a person has not finished reviewing the judge's verdicts. Statuses are defined in docs/install.md.
Evidence
Reports are under evals/reports/; how to read them is in that README.
- synthesis, epoch 3 (
green.json): agentopenai/gpt-6-luna, judgeanthropic/claude-haiku-5-5, OpenCode 1.19.4. One preregistered read on four held-out fixtures, five runs per condition: skill 19/20, baseline 3/20, delta +0.80 (95% interval 0.52 to 0.91), 0 of 15 false fires on negative fixtures. Machine verdictgreen. Human review: 39/39 held-out judgments reviewed; SY1 above the 0.8 agreement floor; SY2–SY5 below floor and demoted to advisory; recomputed verdict green. - synthesis, epoch 2 (
green.epoch2.json): free-tier and Go-gateway models.green-miss: skill 15/20 against a bar of 17/20, traced to the skill not always being loaded. Kept as recorded. - counterfactual, epoch 5 (
red.json,green-dev.json,green.json):green. Agentopenai/gpt-6-luna, judgeanthropic/claude-haiku-5-5, OpenCode 1.19.4. Dev 29/30 under the preregistered pooled bar. One preregistered read on four held-out fixtures, five runs per condition: skill 18/20, baseline 1/20, delta +0.85 (95% interval 0.58 to 0.93), 0 of 15 false fires on negative fixtures. Machine verdictgreen. Human review: 38/38 held-out judgments reviewed; CF2–CF4 above the 0.8 agreement floor; CF1 and CF5 below floor and demoted to advisory; recomputed verdict green. Both skill misses arejudge_error.
What this does not show:
- The gain is largely process visibility: the skill makes the agent write out perspectives, dependence, and a conclusion, which the rubric rewards. Whether answers are also more correct is not measured.
- One host, one model pair, one fixture family. The judge is a single model whose draw is not fixed.
- The copied skills were checked for discovery only on Pi, Codex, and Claude Code, with no model run. The Claude Code and Codex plugin packages were checked by hand in an interactive session (Claude Code 2.1.312, Codex 0.165.0) and in scripted headless runs (
claude -pon Claude Code 2.1.312,codex execon Codex 0.162.1). Those checks show the plugins install and run; they are not evals. On Claude Code and Codex thesynthesisandcounterfactualskills run as host-adapted copies, not the text that was evaluated.
What preregistration proves. Thresholds, rubric, and fixture hashes are committed in evals/<method>/prereg.json before the skill is authored, and the runner reads its bars and hashes from that file. Every manifest and report carries the sha256 of the file's canonical form, so a changed prereg no longer matches the runs made under the old one. This is a content contract, not a proof of git history: the author controls the repository and can rewrite the prereg and re-run. Held-out fixtures stay outside the repository until release.
Reproduce
Evals run locally with your own provider credentials. They never run in CI, and committed reports are allowlist projections: counts, intervals, hashes, and model IDs, never transcripts.
bun install
bun run eval red --method <method> # baseline runs on dev fixtures
bun run eval green --method <method> --provider live # one-shot held-out read, both conditions
bun run eval report --method <method> # regenerate the report projectionRuns happen in a throwaway workspace with a scrubbed environment so nothing from your machine reaches the model; evals/runner/README.md documents the isolation checks and the OpenCode event mapping. Checks that do run in CI: bun run typecheck, bun test, bun run generate:check, bun run matrix:check, bun run scan:secrets.
Releases and automation
Releases use Changesets. Pending changesets produce a version PR; merging it creates the v* tag and a GitHub Release, and the release workflow then publishes the package to npm with provenance. The runbook for the first publish is in docs/install.md. Claude Code and Codex detect plugin updates from the manifest version, so a change to the generated packages (hosts/, .claude-plugin/, .agents/plugins/) or to their generator must carry a changeset to reach users; CI checks this.
Fro Bot reviews pull requests and acts on @fro-bot mentions. The daily autoheal may open one fix PR and must not touch eval evidence (evals/**), skill text (skills/**) or the generated host packages.
Attribution and license
MIT. This project reinterprets concepts from inanna-malick/metacog (MIT, pinned at commit 3d89bb30cd26369fdcd242fd704f66641dca327c). Both copyright notices are in LICENSE. The upstream text that the plugin's tools adapt is described in ATTRIBUTIONS.md.
