📜 SCROLL — a harness for agentic loops
Build AI agents as folders, not code. A filesystem-native harness: an agent is a directory of markdown, the LLM does the work, a thin CLI coordinates. No engine, no database, no runtime lock-in. Runs the same locally and in the cloud — and gives you the outer loop (loop engineering) so an agent finds its own work, does it, verifies it, and remembers it, without you prompting each turn.
npm i -g @agentpro/scroll
scroll new researcher # scaffold a compliant agent (L1-ready: hard-rules + 3 gold evals)
scroll build researcher # render it for Cowork / Codex / Gemini / voice
scroll run researcher --task "…" # inner loop: one harnessed run — capped, gated, checkpointed
scroll loop LOOP.md # outer loop: schedule + find work + stop conditions
MIT · Node >= 20 · Spec v2.5 · @agentpro/scroll 2.5.0 + @agentpro/scroll-telegram 2.5.0 · zero runtime deps · runs on Claude · OpenAI/Codex · Gemini · Grok
GitHub topics: loop-engineering · agent-harness · agentic · agentic-loops · ai-agents · autonomous-agents · tool-retriever · llm · mcp
Why SCROLL
Most agent frameworks make you import a heavy runtime (graphs, schedulers, vector DBs) and lock you to one model vendor. SCROLL bets the opposite way:
|
Heavy frameworks |
SCROLL |
| An agent is… |
an object in code |
a folder of markdown |
| State lives in… |
a database / session |
the filesystem + git |
| Orchestration |
the framework runtime |
a declarative DAG you advance deterministically |
| Safety |
hope the model behaves |
risk-tiered gates + grounding, enforced in code |
| Model |
locked to one vendor |
vendor-neutral — one definition, any runtime |
| The whole framework |
a dependency tree |
a convention + one small CLI |
The thesis in one line: SCROLL doesn't try to make the model smarter — it makes the model's built-in weaknesses unable to cause harm. Every mechanism below compensates for a specific model failure mode.
| Mechanism |
The model weakness it neutralizes |
| Risk-tiered permission matrix |
the model doesn't understand consequences |
| Grounding pre-check |
hallucination (inventing ids / amounts) |
| Tool-boundary enforcement |
sycophancy — it can't be trusted to stop itself |
| External eval (gold cases) |
biased self-assessment |
| Comprehension digest |
the user's passive over-delegation |
Implementation status (2026-11-21 · v2.5)
- §47.2 Portable Tool Retriever & Room-Sticky Group Cache (v2.5) — zero-dep
lib/tool-retriever.js (C/V/E 3-set architecture, multi-field BM25F + batch queries[], host JSON Schema argument validator, Transparent Unwrap tool_invoke, <available_tools> capped <= 1,500 tok compressing 226+ tools to < 5K tok across all 4 providers), Room-Sticky group posture (prefixHash 100% invariant across alternating Owner/Teammate/Guest turns), .scroll/mcp.lock.json TOFU pinning (scroll mcp diff|approve), ASI04 prompt-injection quarantine, and scroll check ban on npx …@latest.
- Hardened Security Boundary, OS Sandbox & D16 Production Telemetry (v2.5) —
lib/sandbox.js (macOS Seatbelt / Linux Bubblewrap + sanitized env allowlist), lib/vault.js (AES-256-GCM encrypted vault + fail-closed ${vault:KEY}), DNS/IPv6/CGNAT 100.64.0.0/10 + manual-redirect SSRF guard + egress_allow, provenance-tagged §22 grounding (anti-laundering) + buffered external streaming, single-use per-call approval tokens + canApprove(), fail-closed read-only confirmEffect probes, lib/chat-telemetry.js (OTel GenAI events.jsonl, hash-chained audit.jsonl + scroll audit --verify-chain, IDENTITY.budget + loop/error circuit breakers, single-writer PID lock), per-conversation mutex, per-round JSONL crash recovery, and §34 openSkills() wired into live chat.
- 4-Provider Parity, Streamable HTTP MCP, Compaction Recovery & Multi-Turn
pass^k Evals (v2.5) — real SSE streaming, parallel function calling, thinking/thoughtSignature preservation, images, and authStore failover across OpenAI, Anthropic, Gemini, and Codex App-Server (base64 vision temp-file bridge + turn-bound RPC callbacks); Streamable HTTP MCP (Mcp-Session-Id + HTTP 404 re-init + Promise.allSettled isolation); token-aware compaction + 400 context_length_exceeded auto-recovery; runChatEvals() (scroll eval --chat --trials k); and lockstep 2-package monorepo (@agentpro/scroll with @agentpro/scroll/chat + @agentpro/scroll-telegram, both dependencies: {}).
- §45–§50 Interactive Chat Runtime, Unified Auth, Live Tools/MCP, Multimodal, Timezone Scheduler & Async Workers (v2.0) —
lib/chat-session.js, lib/memory-tracker.js (channel-agnostic 3-axis user / group / member memory + L5 lessons + nightly Dream), lib/auth.js (file-locked OAuth 2.0 PKCE + localhost loopback callback + Device Flow + 429 failover), lib/codex-app-server.js, lib/scheduler.js, createWorkerPool, and memoryStore.searchHybrid.
- §44 Large deployment knowledge retrieval & source-aware grounding (v1.10) — deterministic BM25 + heading + bigram + code retrieval over
knowledge/, conversational deliverable mode, and source-aware grounding.
- §42–§43 Per-turn internal/external boundary, group wall,
style: & Voice hooks (v1.9) — verified-ID audience classifier, group lowest-trust content wall, machine-enforced style: block, official Voice plugin hooks with claims-invariant protection.
Built & tested (npm test runs all 24 smoke, unit & gate suites with mutation self-tests and isolated /tmp tarball verification):
-
§38–41 People in the agent team — every person gets a card (people/<slug>.md) they write themselves: how to address them, their roles, what they may approve, which channels reach them, and a short note capped by code. Cards live outside agents/, so an agent folder stays shareable. Agents bind to roles (serves: [owner]); the deployment maps roles to people, and every agent of the team — sub-agents included — loads the same card into its cached prefix, so changing how a person is addressed is one edit, not one per agent. A person can own a step in WORK.md: the run asks them, stops there, and resumes when they (and only they) mark it done. An approval names its approver, and the runner checks that person's card — action class, amount, the deployment's ceiling — before the gate opens; every decision goes to a hash-chained audit trail. scroll audit fails when a card, a USER.md or a people/ folder travels inside an agent folder, a skill or a plugin. Agents never edit cards: they propose, and the person decides. The suite plants seventeen bugs in the people and runtime code and fails unless each is caught.
-
§34–36 Skills — use the skills you already have. A SCROLL agent reads skills in the open Agent Skills format (SKILL.md) from its own folder, the repo, and any read-only folder you point it at — another agent tool's skills folder included — with clear precedence and no copying. The model only sees what passed: every skill is validated and scanned (live credentials, exfiltration, remote-code pipes, destructive commands, hidden text, prompt injection) before it reaches the index, and scanned again at read time if it changed; how strict the scan is depends on how much you trust the source, and there is no flag to force a blocked skill in. Skills built around tools the agent lacks are hidden; the rest get a map from their tool names to the agent's (AskUserQuestion → ask_owner) without editing a line of the skill. The index is byte-stable for the prompt cache, capped by count and tokens, and skill_list / skill_view reach the rest. scroll skill eval runs each case with and without the skill on every model you name, with a blind judge, and says whether the skill earns its tokens (keep, retire-or-rewrite, fix). The suite plants eight bugs in the loader and fails unless each is caught.
-
§31–33 Subject memory — one memory per person, group, project or agent, shared by every surface that talks to it (voice, chat, messaging, other agents). The agent proposes; the machine decides: a fact is accepted only with a verbatim quote from a stored turn of the person it is about, through one five-layer gate (taxonomy · evidence · provenance floor · sensitivity + secret scan · instruction-like content). Sessions and day notes give the agent continuity across surfaces; the load contract is built by code, frozen for the session and hashed (cacheable, replayable). Search is deterministic and every read is logged. Forget reaches every copy — journal, checkpoints, stored turns, cards, ledgers — and a tombstone stops it from being learned again. Groups share facts by namespace; one member never sees another's. Zero dependencies, no vector DB, files only; the test suite plants six bugs in the memory code and fails unless each is caught.
-
§28 Effect confirmation — a write is not "done" because the call returned a non-error. lib/effects.js re-reads the state with a separate probe and checks a declared predicate; a mismatch emits effect_unconfirmed and fails the step. financial/destructive writes with no confirm are blocked (fail-closed) and flagged by scroll audit. Corollary: an unknown input field is rejected, never dropped — silently dropping input is how a system reports success for work it never did.
-
§29 Ungraded is not pass — verdict is ternary (pass | fail | ungraded). "No check ran" is counted separately and never folded into ok; a judge that could not run says nothing, so it grades ungraded rather than fail.
-
§30 Fixture provenance — gold cases declare fixture.provenance (product-path | recorded | synthetic); scroll eval prints it beside every verdict and scroll audit flags a suite built only on hand-made fixtures — the shape where a scheduler's execute path is green while its arm path was never run once.
-
Inner loop scroll run — deterministic DAG advance from WORK.md, single controller, cost-gate, append-only blackboard/, hard caps + circuit breaker, stable-prefix caching, model routing, deterministic non-LLM steps, verify-before-done, per-tick checkpoint, events.jsonl.
-
Risk-tiered permissions — five tiers (read_only · reversible_write · external_comm · financial · destructive), enforced at the action boundary in code (not the prompt). Risk is declared as data in .mcp.json / IDENTITY.security, never read from prose.
-
Grounding pre-check — before a financial/destructive action, every critical parameter must trace to a real prior source; a fabricated id/amount never executes.
-
Outer loop scroll loop + LOOP.md — schedule, work-source, and stop conditions for self-directed runs. A loop with no stop condition is refused.
-
Comprehension digest — every run writes a human-readable digest.md from the event stream (no model call), language-aware.
-
scroll eval — gold cases run N times → machine checks + consistency (pass^k) + optional LLM-judge + hash-bound record. (built — earlier docs called this roadmap; it ships.)
-
Per-language token budgeting — scroll cost / the cost gate scale by language (Vietnamese ≈ 1.8× English).
-
Worktree-lite isolation — parallel tasks get isolated working dirs (real git worktree with --worktree on a repo) so two agents never corrupt shared state.
-
Crash-resume — scroll run --resume restores completed tasks from the checkpoint and finishes the rest without re-billing.
-
scroll audit — convention scan + hash-bound compliance report (CI; --verify).
-
Extension installers — scroll mcp add (wire an MCP server/connector into .mcp.json, with ${vault:KEY} credentials + per-tool risk tiers), scroll skill add (install or scaffold a SKILL.md skill, attach it to an agent), scroll plugin add (unpack an agent-pack bundle: agents + skills + merged .mcp.json).
Providers: mock (offline) · codex · claude · openai · anthropic · gemini. On a case-gated live A/B eval the runtime cut billable tokens 50–88% and latency 50–75% vs an unstructured baseline, at equal-or-better quality.
Roadmap: AG-UI / OpenTelemetry event emission · storage adapters (S3/GCS/repo) · registry-backed discovery for mcp add.
Quickstart
1. Install — npm i -g @agentpro/scroll
2. Create an agent — scroll new scaffolds a correct, L1-ready folder:
agents/atlas/
├── IDENTITY.md # who it is + security (risk tiers) — machine-readable frontmatter
├── SOUL.md # how it thinks (you write this part)
├── TOOLS.md # what it can use
├── hard-rules.md # rules it must never break
├── memory/ # what it remembers
└── evals/ # 3 gold cases — graded by `scroll eval`
3. Build, run, loop:
scroll check atlas # validate structure (pre-commit + CI)
scroll build atlas # → Cowork / Codex / Gemini / Claude-subagent / A2A
scroll run atlas --task "…" # inner loop: deterministic, capped, gated, checkpointed
scroll loop LOOP.md # outer loop: scheduled, self-directed, with stop conditions
Inner loop vs. outer loop (loop engineering)
The shift the field is naming loop engineering is from writing prompts to designing the system that prompts the agent. SCROLL gives you both halves explicitly:
scroll run — the inner loop. One harnessed execution of a WORK.md: advance the DAG, act inside a step, verify, checkpoint.
LOOP.md + scroll loop — the outer loop. Defines when to start an inner loop (schedule), where it finds work (work_source), and when to stop (stop_conditions — required). It rides your host scheduler (cron / scheduled-tasks); there's no daemon engine.
# LOOP.md
id: market-watch-daily
controller: lead
schedule: { cron: "0 7 * * *" }
work_source: { type: work_file, query: WORK.md }
stop_conditions:{ max_runs_per_day: 4, budget_usd_per_day: 5, halt_on: [gate_denied, verify_fail] }
digest: required
The outer loop never escalates privilege — every action inside still passes the permission matrix below — and writes a digest after every run.
Safety: risk tiers + grounding, enforced in code
A model is sycophantic and prompt-injectable, so it can't be trusted to stop before a dangerous action. SCROLL puts the gate in deterministic code, in front of the action.
Five tiers, lowest → highest consequence, each mapped to a policy:
| tier |
default policy |
read_only |
auto |
reversible_write |
auto + log |
external_comm |
soft-hold |
financial |
must-approve + grounding |
destructive |
must-approve + grounding |
Risk is data, not prose — declared per-tool in .mcp.json or per-namespace in IDENTITY.security (a label a model can read is just another prompt it can be talked out of):