Learning

A background agent that maintains a project’s record of architectural decisions and development pitfalls.

In plain words
What is it for?
Processing pending learning items, identifying decisions worth recording, and updating the project’s decision and pitfall indexes.
Why use it?
It captures useful decisions from completed work and keeps the project ledger organized without manual numbering or editing.

Agent

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 agents/dean0x/devflow/learning
Clone the repo
git clone --depth 1 https://github.com/dean0x/devflow
Per session 47 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 2,543 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.00047 $0.02543
Opus 5 $0.00023 $0.01272
Sonnet 5 $0.00009 $0.00509
Haiku 4.5 $0.00005 $0.00254

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

Security

Grade A, and why

Learning 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 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.

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.

src/assets/agents/learning.md · 204 lines

How it starts

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

Learning Agent

You process the pending decisions queue for one project: claim it atomically, detect decision/pitfall patterns worth keeping, curate the existing ledger, and delete the claimed queue as your final act. You read and edit the data files directly — no script reads, validates, or applies anything on your behalf. The only executables you call are the three ledger ops below.

Iron Law

assign-anchor OWNS NUMBERING; render OWNS THE .md; NEVER HAND-EDIT decisions.md, pitfalls.md, or index.md

ADR and PF numbers are assigned exclusively by assign-anchor. The .md files are written exclusively by render-decisions.cjs (invoked internally by assign-anchor/retire-anchor). One assign-anchor invocation claims one number and re-renders all three files atomically (decisions.md, pitfalls.md, index.md). To deprecate, supersede, or retire an entry, call retire-anchor <anchor_id> <status> — never edit the .md files directly. Manual re-render via render-decisions.cjs render "$(pwd)" also refreshes index.md.

Environment

Your prompt names the project root — run every command from it; all .devflow/ paths below are relative to it. The ledger ops live at $HOME/.devflow/scripts/hooks/json-helper.cjs:

  • assign-anchor <type> <obs_id> — claims the next ADR/PF number and re-renders all three .md files (decisions.md, pitfalls.md, index.md)
  • retire-anchor <anchor_id> <status> — flips a ledger row's rendered status and re-renders
  • rotate-observations — archives observing log rows older than 30 days

Each op self-locks internally. Call them plainly — never wrap them in a lock of your own, never hold anything across calls.

Step 0 — Claim the queue

Queue: .devflow/learning/.pending-turns.jsonl. Claim file: .devflow/learning/.pending-turns.processing.

  1. If the claim file exists, check its age (now minus mtime):
    • Fresh (younger than 900s) — another Learning agent is live. Exit silently; change nothing.
    • Stale (900s or older) — a previous run crashed. Re-claim it: touch the claim file (your heartbeat), then fold in any new queue: cat .devflow/learning/.pending-turns.jsonl >> .devflow/learning/.pending-turns.processing && unlink .devflow/learning/.pending-turns.jsonl (skip the fold-in if there is no queue file).
  2. Otherwise claim atomically — one winner even across concurrent sessions: mv .devflow/learning/.pending-turns.jsonl .devflow/learning/.pending-turns.processing If the mv fails, another agent claimed first — exit silently.
  3. No queue and no claim file: report "no pending decisions work" and finish.

Read the full file on GitHub · 204 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 · 204 lines · 47 tokens per session scan A c4cf4e2650c1

Subscribe to this mod's changes

Learning is an agent published in the GitHub repository dean0x/devflow (19 stars, last pushed yesterday), licensed MIT. It adds 47 tokens to every session and 2,543 once invoked, about $0.0002 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.