chain

A generator for exam-style problems that combine several learned problem patterns. A pattern is a reusable method or structure from a homework or example problem.

In plain words
What is it for?
Use it to create multi-part problems that chain two to four methods, solve them on paper, and submit the scan to the grading command.
Why use it?
It gives practice with deciding which method to use next when one result becomes the input to another. The selected problems can also target weak areas and cover different course sources.

Command

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 commands/optimeta/paideia/chain
Clone the repo
git clone --depth 1 https://github.com/OPTIMETA/PAIDEIA
Per session 28 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 963 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. 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.00028 $0.00963
Opus 5 $0.00014 $0.00481
Sonnet 5 $0.00006 $0.00193
Haiku 4.5 $0.00003 $0.00096

Measured 2d ago against content hash a119f2311ef8, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

chain scanned grade A with 0 findings 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 2d ago.

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.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

plugins/paideia/commands/chain.md · 69 lines

How it starts

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

Output language

Read INTERFACE_LANG from .course-meta (default en). All user-facing prose must be in that language. Keep in English regardless: file paths, slash command names, pattern IDs, LaTeX, and YAML keys (problem_id:, pattern:, error_type:, source:, etc.).

Load skills/exam-drill/SKILL.md. Read course-index/patterns.md, course-index/coverage.md.

N (pattern count): $ARGUMENTS (default 2, max 4)

Procedure:

  1. Select N patterns with constraints:

    • From ≥ N different source problems (span HW/example origins; don't pick 2 patterns both from HW1)
    • At least one pattern from the user's weak zone (sections flagged ⚠weak in coverage.md, or the latest weakmap's top entries)
    • At least one pattern from a 🔥🔥 Exam-primary section with no recent entry in errors/log.md (user has machinery)
    • Patterns must be composable (pattern A's output = pattern B's input)
  2. Design the problem as a multi-part question:

    • Part (a): establishes context, requires pattern 1
    • Part (b): uses result from (a), requires pattern 2
    • Part (c): ties together, requires pattern 3 (if N=3)
    • Final answer should synthesize
  3. Save (the stem is the bare <ts> — never an exam_ prefix; this is a chain drill, not a mock, even though the problem is exam-style):

    • Problem → chain/<ts>.md ← e.g. chain/20260611_213319.md, NOT chain/exam_…
    • Solution → chain/<ts>_sol.md (hidden)

    Why it matters: the user uploads their answer as answers/chain_<ts>.pdf and /grade resolves chain_<ts>.pdf → chain/<ts>_sol.md. An exam_ prefix here makes the saved file disagree with both the upload name you print in Step 4 and the /grade rule, and leaves a chain/ folder with inconsistent stems. exam_* names belong to /mock only.

  4. Print:

    • Full problem
    • Estimated time (N × 6 min + 5 min setup)
    • Do NOT reveal which patterns are used
    • Closing (in $INTERFACE_LANG): "Solve on paper, upload as answers/chain_<ts>.pdf, then /grade. At the end of your solution, also write down 'which pattern you used' — that's the core of the recognition drill."
  5. When user submits:

    • /grade converts PDF → MD → checks:
      • Did they identify all N patterns?
      • Did they use them in the correct order?
      • Does the final synthesis match?
    • Errors are logged by /grade via scripts/log_tool.py using the canonical errors/log.md schema from skills/answer-processing/SKILL.md Step 6 — one entry per missed pattern, with problem_id: chain_<ts>-P<n>, pattern: <Pk>, error_type: (pattern-missed for an unidentified or out-of-order pattern), and source: chain/<ts> (that same value is the --source= argument, so a re-grade replaces rather than piles up). Do not invent a chain_problem key — the tool rejects off-schema entries, and statusline.py, session_start.py, and weakmap regex on pattern:/problem_id:, so any drift silently hides chain errors from the weakness snapshot.

Read the full file on GitHub · 69 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. 2d ago First seen · 69 lines · 28 tokens per session scan A a119f2311ef8

Subscribe to this mod's changes

chain is a command published in the GitHub repository OPTIMETA/PAIDEIA (91 stars, last pushed 1mo ago), licensed MIT. It adds 28 tokens to every session and 963 once invoked, about $0.0001 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.