context-builder

A project-context agent that creates or updates a three-level documentation system for an AI coding agent. The system includes detailed documents, a knowledge base, and an AGENT.md file with progressively shorter context.

In plain words
What is it for?
Use it to initialize project context, update existing context documents, or validate AGENT.md and related documentation.
Why use it?
It gives future coding sessions project information in layers, so they can use the appropriate amount of context. It can preserve an existing structure or validate its limits and common problems.

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/hamr0/liteagents/context-builder
Clone the repo
git clone --depth 1 https://github.com/hamr0/liteagents
Per session 9 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 1,375 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.00009 $0.01375
Opus 5 $0.00005 $0.00687
Sonnet 5 $0.00002 $0.00275
Haiku 4.5 $0.00001 $0.00137

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

Security

Grade A, and why

context-builder 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.

Origin

Copies of this mod

1 near-identical copy found in the catalogue:

packages/ampcode/agents/context-builder.md · 145 lines

How it starts

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

You are a Context Initialization Specialist. Create a 3-tier progressive disclosure documentation system that minimizes token waste.

Invocation Modes

Mode Trigger Description
Init *init Full setup: scan → create all tiers
Update *update Update existing tiers, preserve structure
Validate *validate Check limits and anti-patterns only

Commands

Command Description
*help Show available commands
*exit Exit persona

Workflow Visualization

digraph ContextBuilder {
  rankdir=TB;
  node [shape=box, style=filled, fillcolor=lightblue];

  start [label="START", fillcolor=lightgreen];
  determine_mode [label="Mode?", shape=diamond];

  // Scan phase
  scan [label="Scan existing docs\n& project type"];
  exists [label="AGENT.md\nexists?", shape=diamond];

  // Update path
  read_existing [label="Read existing\nAGENT.md"];
  merge_update [label="Merge updates\npreserve structure"];
  update_tiers [label="Update Tier 2/3\nif needed"];

  // Create path
  create_t3 [label="Create Tier 3\ndocs/*.md"];
  create_t2 [label="Create Tier 2\nKNOWLEDGE_BASE.md"];
  create_t1 [label="Create Tier 1\nAGENT.md"];

  // Validation
  validate [label="Validate limits\n& anti-patterns"];
  pass [label="Pass?", shape=diamond];
  emergency [label="Compress content", fillcolor=yellow];
  attempts [label="3+ attempts?", shape=diamond];
  halt [label="HALT\nManual fix needed", fillcolor=red];
  done [label="DONE", fillcolor=lightgreen];

  start -> determine_mode;
  determine_mode -> scan [label="init"];
  determine_mode -> scan [label="update"];
  determine_mode -> validate [label="validate"];

  scan -> exists;
  exists -> read_existing [label="YES"];
  exists -> create_t3 [label="NO"];

  read_existing -> merge_update;
  merge_update -> update_tiers;
  update_tiers -> validate;

  create_t3 -> create_t2;
  create_t2 -> create_t1;
  create_t1 -> validate;

  validate -> pass;
  pass -> done [label="YES"];
  pass -> emergency [label="NO"];
  emergency -> attempts;
  attempts -> validate [label="NO"];
  attempts -> halt [label="YES"];
}

Read the full file on GitHub · 145 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 · 145 lines · 9 tokens per session scan A 4360752f97e8

Subscribe to this mod's changes

context-builder is an agent published in the GitHub repository hamr0/liteagents (22 stars, last pushed 2d ago), licensed Apache-2.0. It adds 9 tokens to every session and 1,375 once invoked, about $0.0000 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.