Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Use this skill at the start of any non-trivial session in this ecosystem -- the single biggest lever for reducing token / quota / context-window consumption and for keeping the agent productive across sessions. Make sure to load this whenever the work involves more than a few file reads, any PDF handling, multi-file editing, web fetching, or continuation of prior-session work, EVEN IF THE USER DOES NOT MENTION IT. Codifies five disciplines: tool selection (Read/Grep/Glob/Edit/Write over Bash equ
| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-05 | ✗→✓ | ▲ Improved | 453% | 0% |
| case-07 | ✗→✓ | ▲ Improved | 343% | 0% |
| case-08 | ✗→✓ | ▲ Improved | 467% | 0% |
| case-10 | ✗→✓ | ▲ Improved | 274% | 0% |
| case-11 | ✗→✓ | ▲ Improved | 227% | 0% |
This skill follows the three-level progressive disclosure pattern codified by Anthropic's skill-creator (see "Adjacent prior art + lineage" below):
SKILL.md, ~250 lines. Contains the universal rules + the decision-procedure for which references to consult.
references/*.md files-- one per discipline. Loaded only when a session actually exercises that discipline.
PreToolUse / Stop) that mechanise the protocols here so they fire reliably without depending on agent discipline alone. Specification in section "Planned future work: enforcement hooks" below.
This is the same pattern the skill itself preaches: load only what you are about to use; defer the rest.
Load this skill at the start of any session that will involve any of:
material);
cross-session memory matters).
In practice that's most non-trivial sessions in this ecosystem. The universal one-liners in ~/.scicomp-research-skills/AGENTS.md Section 6 cover the basics so cheap-and-fast rules fire even without this skill loaded; this skill expands them with the full how-to.
Agent tokens / quota / context-window are the scarcest resources in any non-trivial session. Beyond raw cost, the attention budget -- the agent's ability to pick the right detail out of its context -- degrades faster than the nominal context window suggests. Empirical work (Chroma's "context rot" study, cited by Anthropic in their Sep 2025 Effective Context Engineering for AI Agents post) shows that recall quality drops well before the window fills. Heavily-loaded contexts also introduce recency bias and goal drift. This skill therefore optimises for both raw token cost AND for keeping the working set small enough that the agent's attention stays sharp.
Default agent behaviour wastes resources in predictable ways:
bash grep instead of the dedicated Greptool, bash cat instead of Read, ...) costs tokens AND loses features (paging, structured results).
Read with no offset/limit on a 2000-line file when50 lines would do) burn context window for no gain AND accelerate context rot.
survey note last session) wastes tokens AND risks contradicting the prior summary.
at session start) causes the agent to either re-do work or to make decisions inconsistent with prior sessions.
session) burns external quota and adds latency.
recent attention as conversation length grows. Manus calls this the "lost-in-the-middle" failure mode and addresses it via recitation (re-reading the plan into recent context).
These are all preventable with explicit rules. This skill codifies them as a research-flavoured operationalisation of the broader file-as-memory + just-in-time retrieval patterns now standard in the agent-engineering literature.
This skill loads a small SKILL.md (you are reading it) and provides five per-topic reference files, each loaded on demand. Each codifies one resource-management discipline:
| Discipline | Reference file | When to load | |:-------------------------|:----------------------------------------|:--------------------------------------------------| | Tool selection | references/tool-selection.md | First time in this session you need a non-trivial file/search/edit operation. | | Targeted reads | (covered in tool-selection.md) | (same) | | PDF lifecycle | references/pdf-lifecycle.md | Whenever a session involves PDF intake or re-reading. | | Persistent memory | references/persistent-memory.md | Start of any session on a project with PLAN.md / collection log / notes index. | | Context-window budget | references/context-window-budget.md | When loading multiple skills, multiple reference files, or multiple PDFs simultaneously. | | Web-fetch discipline | references/web-fetch-discipline.md | Whenever WebFetch is called in this session. |
Load only the references relevant to the current session. Do NOT load all five at once -- that defeats the purpose.
These are also in ~/.scicomp-research-skills/AGENTS.md Section 6, so they fire even if this skill is not loaded. Restated here for in-skill reference:
Glob (not find / ls -R).Grep (not bash grep / bash rg).Read (not cat / head / tail).Edit (not sed / awk).Write (not cat <<EOF / echo >).echo / printf).with three independent Reads costs less and finishes faster than three sequential messages.
Grep firstto locate the relevant section OR Read with explicit offset+limit. The default 2000-line Read is for skimming, not routine consumption.
a PDF, check notes/survey_<citekey>.md. Before re-deriving a fact, check the audit log / notes / PLAN.md.
PLAN.md status +_collection_log.md + notes/README.md at session start; update them at session end if work was done.
calls, re-read PLAN.md (or the relevant section thereof) every ~30-50 calls to combat goal drift. The Manus team identified this as the simplest defence against the "lost-in-the-middle" failure mode in long agent runs. Recitation is cheap; goal drift is expensive.
AGENTS.md or system-prompt-equivalent filesmid-session. If the agent client uses prompt caching (Claude Code does, OpenCode does for Claude models), editing the cached prefix invalidates the cache and silently 10x's the per-token cost of all subsequent calls in the session. Restart the session if you genuinely need to change agent-facing rules.
tool call fails (dead URL, rate limit, file not found), let the error sit in the conversation so the model adapts. Silent retry loops both burn quota and hide useful failure signal. For structural failures (a citation's PDF really is unobtainable, an arXiv ID is wrong), log to the appropriate audit entry (_collection_log.md "Items not found / left for user", PLAN.md "Open Questions") so the failure becomes part of the persistent record.
OpenCode (and Claude Code, and Cursor) on Claude models supports prompt caching of stable prefixes (system prompt + tools + typically the most recently loaded skill content). Cached tokens are ~10x cheaper than uncached. Implication: re-loading a small skill via Read mid-session is cheaper than carrying its content forward in conversation, because the cached version pays cached-rate on every subsequent turn. This is part of why the progressive-disclosure model above works: levels 2 + 3 can be loaded fresh when needed without worrying that they'll dominate cost.
The agent will, in real sessions, invent plausible-sounding reasons to skip the disciplines above. The pattern is sufficiently consistent that we name + rebut the common ones explicitly. When the agent catches itself thinking one of these, it should treat that thought as a signal to STOP and re-evaluate.
| Rationalization | Why the agent thinks it | Rebuttal | |:------------------------------------------------------------------|:-------------------------------------------------------------------|:---------------------------------------------------------------------------------------------------------------| | "I already read this file last turn; I'll trust my memory." | Avoids the cost of re-Read-ing. | The file might have been edited (by you or the user). Read is cheap; recall is not always reliable. | | "It's just one extra bash cat, no big deal." | The override feels small in isolation. | This is the rationalization that turns a 200-token session into a 20k-token session. One bash-cat is fine; the habit isn't. | | "Let me re-read the PDF to make sure the survey note is right." | Healthy scepticism + low confidence in your own past summaries. | If you have specific reason to doubt the note, target-grep the .txt for the suspect fact. If not, trust the note; that's what it's for. Re-reading the whole PDF "to be safe" is the most expensive single action in this ecosystem. | | "I'll load all the section references now so I have them ready." | Tidy-up instinct; wants to "set up" before working. | Loading speculatively is the failure mode the context-window-budget exists to prevent. Load when you actually use. | | "I'll fetch the publisher page to confirm the year." | Wants external verification; doesn't trust local data. | The user verified the bib entry; that's what verification IS. Trust the bib unless you have specific reason to doubt it. | | "I'll skip updating notes/README.md; it's just an index." | The deposit feels like overhead at the end of a session. | The deposit funds the next session's withdrawal. Skipping it is the most expensive bug in this ecosystem. | | "I'll process all 14 PDFs now while I have momentum." | Wants to batch-finish a sub-task. | Process one at a time; close each before opening the next. The context-window cost of 14 simultaneous .txt files is much larger than the round-trip cost of 14 separate Reads. | | "Let me just retry that fetch, it might work this time." | Hope-based rather than evidence-based. | Twice per session is the cap. After that, log to "Items not found" and move on. | | "I'll silently fix this typo in the bib." | Helpful instinct; wants to clean up. | Silent fixes break the audit trail. Add a "Corrections to apply" entry; let the user batch-apply. | | "It's a small task; the protocol overhead would dominate." | Wants to skip first-action / last-action for speed. | A genuinely small task (one file edit, one question answered) is fine. Anything multi-file or multi-step earns the protocol's overhead back several times over. |
If you (the agent) find yourself thinking ANY of the left-column phrases mid-session, stop and re-read this table.
At the start of any session that touches a project with the standard layout (paper-skeleton or similar):
AGENTS.md, PLAN.md(status fields + open questions), references/_collection_log.md (verification status), notes/README.md (which surveys exist + their status). Total: 4 small reads.
writing? literature-survey? human-facing-doc-authoring? this skill? often only 1-2 are relevant -- not all of them).
skill (e.g. just references/introduction.md from research-paper-writing, not the whole references/ tree).
Step 1 is cheap (4 small reads) and prevents the most common waste mode: doing work the previous session already did, or doing work inconsistent with what the previous session decided.
Before declaring the session done:
notes/README.md.references/_collection_log.md.
PLAN.md status field.PLAN.md outline + maybe addnotes/section_<N>.md.
discovered contradicts prior notes / plan / bib entries, do not silently proceed; add a "Corrections to apply" entry to the relevant log.
Steps 1+2 are the "deposit" that funds the next session's cheap "withdrawal" via the first-action protocol.
When this skill is loaded, every action the agent takes should be auditable against the rules above. If the agent finds itself about to:
use the dedicated tool.
Read of a >300-line file -> stop and either Grep firstor use offset+limit.
PLAN.md / _collection_log.md /notes/README.md -> stop and read them (in parallel).
The goal is no avoidable waste, not "minimise tokens at the cost of correctness". When the rules conflict with correctness, correctness wins -- and the conflict gets logged as a "Corrections to apply" entry so the rule can be refined.
This skill assumes the agent has tools approximately equivalent to OpenCode's Read, Grep, Glob, Edit, Write, Bash, and WebFetch. For agents with more limited toolsets:
pdftotext, rg, fd, sed/awk carefully (quote everything; prefer here-docs over echo chains; cap output with head/tail EXPLICITLY rather than relying on the agent's truncation).
references/web-fetch-discipline.mdfor the protocol of caching fetches into the repo via shell commands (curl -> references/_cache/<hash>.html).
rule simply does not apply, but the targeted-read and re-use-prior-work rules still do.
This skill is a research-flavoured aggregation of patterns that have crystallised across the agent-engineering literature since mid-2025. Citations are given so users (and future maintainers) know what we borrowed, what we adapted, and where the genuinely novel pieces are.
Foundational sources (cited in the rules above):
Lessons from Building Manus (https://manus.im/blog/Context-Engineering-for-AI-Agents-Lessons-from-Building-Manus). Source for the file-as-memory pattern (rule 5 of their post), recitation against goal drift (rule 4 -> our Critical Rule 6), KV-cache stability (rule 1 -> our Critical Rule 7), and keep-errors-in-context (rule 5 -> our Critical Rule 8).
Agents (Sep 2025, https://www.anthropic.com/engineering/effective-context-engineering-for-ai-agents). Source for the "attention budget" framing in "Why this matters", the "context rot" empirical finding (Chroma research, https://research.trychroma.com/context-rot), and the hybrid pre-load + just-in-time retrieval pattern that underlies our first-action protocol.
Agent Skills (Oct 2025, https://www.anthropic.com/engineering/equipping-agents-for-the-real-world-with-agent-skills). Source for the three-level progressive-disclosure pattern this skill follows; informs the SKILL.md length budget guidance in references/context-window-budget.md.
agents (Sep 2025, https://www.anthropic.com/engineering/writing-tools-for-agents). Tool-author-side counterpart of our discipline 1; informs why dedicated Read/Grep/Glob are higher-signal than Bash equivalents.
https://arxiv.org/abs/2310.08560). Academic ancestor of all subsequent file-as-memory patterns; introduces the OS-memory-hierarchy framing.
Closest comparable agent-rule skills:
OthmanAdi/planning-with-files(https://github.com/OthmanAdi/planning-with-files) -- 3-file workflow (task_plan.md / findings.md / progress.md) enforced via SessionStart / PreToolUse / Stop hooks. The hook-enforcement pattern is the model for our planned future work below; their evidence-based 96.7% pass-rate (vs 6.7% baseline) is what motivates shipping hooks rather than relying on agent discipline alone.
thedotmack/claude-mem(https://github.com/thedotmack/claude-mem) -- automated observation capture into SQLite + Chroma vector DB with lifecycle hooks. We deliberately diverge: our markdown-on-disk approach is git-diffable, blameable, and human-readable, which matters more for research reproducibility than the higher recall of an embedding store. Both approaches are valid; pick by use case.
addyosmani/agent-skills(https://github.com/addyosmani/agent-skills) -- 22 production- engineering skills with anti-rationalization tables in every skill; we adopted that pattern explicitly in "Common rationalizations + rebuttals" above.
anthropics/skills/skill-creator(https://github.com/anthropics/skills/blob/main/skills/skill-creator/SKILL.md) -- the authoritative how-to-write-a-skill skill; informs our three-level progressive-disclosure structure and the "pushy description" anti-undertriggering convention applied to this skill's own description.
Future-House/paper-qa (PaperQA2)(https://github.com/Future-House/paper-qa) -- programmatic RAG over PDFs (parse + cache + embed + retrieve). Solves the same problem as our PDF lifecycle (avoid re-reading PDFs) with a fundamentally different mechanism (vector embeddings vs human- curated survey notes). Our references/pdf-lifecycle.md discusses the trade-off explicitly; both approaches are valid.
Where we are genuinely novel (per the prior-art audit, no publicly-available agent-rule skill found that codifies these):
with notes/survey_<citekey>.md as the agent-readable cache.
fields and survey notes consulted before WebFetch; arXiv abstract preferred over PDF page; cache to references/_cache/).
five disciplines together with a coherent first-action / last-action protocol grounded in a research-paper-skeleton's specific file layout.
Adjacent ecosystems (mentioned for context, not directly borrowed):
(https://docs.cline.bot/prompting/cline-memory-bank) -- one-task- one-goal + auto-compact + .clineignore patterns. We have no .agentignore analogue yet; possible future addition.
parallel but different abstraction layer.
scope for an agent-operation skill.
The disciplines above currently rely on agent self-discipline. The single biggest reliability improvement available is to mechanise the first-action / last-action protocols as hooks invoked by the agent client, so the protocol fires regardless of whether the agent remembered to follow it.
OthmanAdi/planning-with-files reports a 96.7% pass-rate on Anthropic's skill-creator eval after introducing PreToolUse + PostToolUse + Stop hooks vs 6.7% without. Our expectation is similar gains for the first/last-action protocols, because the same failure mode -- agent skipping the bookkeeping when context fills up -- is what the hooks defend against.
Hooks are deferred for now (kept the repo simple at this stage). When implemented, the design should be:
Layout (probably bin/hooks/ shipped in this repo, with users copying or symlinking into their per-project .opencode/hooks/):
textbin/hooks/ ├── session-start.sh reads AGENTS.md + PLAN.md (status section) │ + _collection_log.md (Last updated + │ Corrections-to-apply) + notes/README.md │ (status section). Echoes a compact │ summary into the agent's startup context. ├── pre-tool-use.sh on tool calls that risk losing work │ (Edit, Write, Bash with `git commit`), │ checks PLAN.md mtime > AGENTS.md mtime, │ warns if AGENTS.md was edited mid-session │ (Critical Rule 7 violation). ├── post-tool-use.sh on Write / Edit calls under notes/ or │ references/, prompts the agent to update │ notes/README.md or _collection_log.md if │ the modified file is a new survey note or │ a new bib entry. └── stop.sh before declaring session done, checks that PLAN.md / _collection_log.md / notes/README.md have been touched if survey notes / bib entries / experiment dirs changed during the session. If not, refuses to stop and prompts for the last-action update.
Compatibility: the hooks should be CLI-agnostic shell scripts (no agent-client-specific assumptions in the hook bodies); each agent client (OpenCode, Claude Code, Cursor) wires them via its own hook mechanism, but the script bodies are portable.
Implementation order when picked up:
session-start.sh -- highest payoff, lowest implementation risk.Single read-only pass over 4 files; echoes a status summary.
stop.sh -- second-highest payoff. Walks git status for changesunder notes/ / references/ / experiments/ and verifies the matching index was updated. Refuses to stop if not.
post-tool-use.sh -- soft prompt; less critical.pre-tool-use.sh -- defensive against Critical Rule 7 violation;only relevant for users iterating heavily on AGENTS.md.
Open questions to resolve at implementation time:
.opencode/hooks/ per repo?~/.config/opencode/hooks/ user-global?). Per-repo is more correct but requires users to copy explicitly.
should never feel the hook is in the way of legitimate work).
~/.scicomp-research-skills.hooks.logfor debugging (probably yes, very small).
least.
When to revisit: when at least 3 real research-paper sessions have shown the agent skipping the first-action or last-action protocol despite the rules being loaded. Until then, the cost of maintaining hooks across multiple agent clients exceeds the benefit.
references/tool-selection.md -- dedicated-tools-vs-bash + targetedread rules + parallelism rules.
references/pdf-lifecycle.md -- one-shot pdftotext extraction;survey-note-first lookup; section-targeted reads of .txt files.
references/persistent-memory.md -- first-action / last-actionprotocols for cross-session memory; the indices as memory.
references/context-window-budget.md -- max-N skills / references /PDFs simultaneously; when to summarise + close.
references/web-fetch-discipline.md -- cache-first; bib-fieldsbefore publisher page; arXiv abstract over PDF.
~/.scicomp-research-skills/AGENTS.md Section 6 are a strict subset of the rules above; that section is what fires for agents that have not loaded this skill.
Created 2026-05-13 by A. Attia. Distilled from observed waste modes across multiple agent sessions on the rl-oed paper + this skills repository's own bootstrapping. Revised 2026-05-13 (post-prior-art audit): adopted progressive-disclosure framing + pushy description (Anthropic skill-creator); added "Why this matters" framing around attention-budget + context-rot (Anthropic context-engineering post + Chroma); added Critical Rules 6-8 (recitation, no-mid-session-prompt- edits, keep-errors-in-conversation) from Manus; added prompt-caching note; added "Common rationalizations + rebuttals" table (addyosmani/agent-skills pattern); added "Adjacent prior art + lineage" section citing Manus / Anthropic / planning-with-files / claude-mem / addyosmani / paper-qa / MemGPT; added "Planned future work: enforcement hooks" with full spec (deferred implementation, specification kept here so future work has the design ready).
Other measured skills in the registry, with their headline benchmark lift.