Tiny Context is a lightweight, repo-native glue layer for coding agents. It provides durable project memory (project_context/**), an ultra-compact startup contract (AGENTS.md, ~500 tokens), progressive L1 discovery, and 5 opt-in workflow skills for the full R&D lifecycle.
- Source version:
0.12.1| Schema:5(upgrade-requiredfrom schema 4) - Specs & Guides: Product Spec · Design Principles · Agent Surface Recipes · Design Resources · Migration Notes · 中文说明
Requires Node.js 24+. Install the package version you intend to use, then initialize:
npm install --save-dev project-tiny-context-harness
npx --no-install ty-context initPlain init creates only 4 files: AGENTS.md, .agent/config.yaml, project_context/global.md, and project_context/context.toml. No architecture doc, Area, design system, Skill, Hook, Makefile, or CI workflow is auto-installed.
- Existing repository: add
--adopt. - Custom harness config folder (e.g. Antigravity
.agents,.codex,.claude,.cursor): pass--harness-folder <path>on initial setup. - For an unreleased checkout, build and install its local tarball rather than assuming the published package matches source.
Tiny Context layers memory by abstraction and change rate so fresh sessions recover accurately with minimal token cost:
| Layer | Surface | Cost & Change Rate | Purpose |
|---|---|---|---|
| L0 | AGENTS.md managed block |
~500 tokens · rarely changes | Context contract, first-principles & evidence calibration, authorization boundaries |
| L1 | project_context/context.toml (summary, owns, areas) |
Compact map · changes on module topology changes | Deterministic discovery of default and on-demand owners |
| L2 | project_context/**/*.md |
Loaded per hit · changes on settled decisions | Goals, non-goals, boundaries, decisions with rationale, entrypoints |
| L3 | Code, tests, and ty-context-controlling-source files |
Loaded on demand · changes every iteration | Exact implementation values, API specs, adopted design prototypes |
npx --no-install ty-context context list --default [--json]
npx --no-install ty-context context list --index [--json]
npx --no-install ty-context context for src/payments/refund.ts [--query "recovery"] [--with-defaults] [--json]
npx --no-install ty-context context inspect project_context/global.md- L1 index (
context list --index): compact 1-line-per-file map of default, on-demand, and unregistered Context with estimated token counts. - Deterministic path routing (
context for <path>): resolves owning Context files from affected code paths ([[context]].ownsprefixes/globs and[[areas]].root) or literal--queryterms without waiting for trigger keywords. - Offline reading without CLI: read
project_context/global.mdplusproject_context/context.toml(default_fileswithout child traversal, default Area,read_policy = "default"nodes and transitivedefault_children, plusowns/summaryfor on-demand routing). Invalid manifests exit non-zero; failed queries are incomplete, never an empty set.
Example optional project_context/context.toml:
default_files = ["project_context/architecture.md"]
[[areas]]
id = "payments"
root = "src/payments"
context = "project_context/areas/payments.md"
kind = "service"
summary = "Payment lifecycle, ledger boundaries, and provider constraints"
[[context]]
path = "project_context/areas/payments/recovery.md"
role = "domain"
read_policy = "on-demand"
summary = "Idempotency keys, webhook retry limits, and settlement recovery rules"
owns = ["src/payments/recovery/**", "src/payments/webhooks/**"]
triggers = ["payment recovery"]Write summary as scope (what the doc owns), not volatile details, and bind owns to directory/module prefixes so routine edits never churn L1 metadata.
The package ships 5 opt-in workflow skills covering the end-to-end R&D lifecycle without bloating AGENTS.md or imposing mandatory gates:
| Skill | Role in lifecycle | On-demand L3 references |
|---|---|---|
solution-research |
First-principles problem framing, 3 distinct options, counter-evidence, and full lifecycle cost | full-cost-framework.md |
design-resource |
UI/UX reasoning, repo-native interactive prototypes (with annotation overlay), delta revisions, scoped adoption, optional Stitch | design-reasoning.md, design-method.md, visual-language.md, patterns.md, motion.md, adoption.md, stitch.md |
durable-goal |
Upfront task index, full requirements, unique actionable plan, strict plan-change authorization, hard stop before execution | technical-implementation.md |
handoff |
Post-research/design plan settlement, mid-dev session handoff, bounded cleanup, copy-ready continuation prompt | host-modes.md |
development-execution |
Proactive 3-stage verify-and-fix loop, symptom-driven diagnostics, module/batch discipline, engineering & runtime boundaries | engineering-boundaries.md, runtime-verification.md |
Install only the skills your project wants (defaults to <harness-root>/skills, refuses to overwrite existing project skills without --overwrite), and put project-specific paths, tools, or rules inside <skill>/local/ (e.g., local/adapter.md) so future upstream refreshes never clobber local customizations:
npx --no-install ty-context skill list [--target .agents/skills] [--json]
npx --no-install ty-context skill install solution-research durable-goal handoff [--target .agents/skills]
npx --no-install ty-context skill install --all [--target .agents/skills] [--dry-run]
npx --no-install ty-context skill update [--target .agents/skills] [--dry-run]Installed skills remain project-owned: init, sync, and upgrade never auto-install or overwrite them. Both skill update (which refreshes only already-installed packaged skills) and skill install --overwrite strictly preserve <skill>/local/** untouched while updating upstream files. See docs/design-resources.md for repo-native design resource adoption and Skill composition details.
npx --no-install ty-context context create --path project_context/payments.md --role domain
npx --no-install ty-context context register --path project_context/payments.md --role domain --summary "Payment boundaries" --owns "src/payments/**" [--apply]
npx --no-install ty-context context move --from project_context/payments.md --to project_context/billing.md [--apply]
npx --no-install ty-context context transaction status|complete|rollback
npx --no-install ty-context synccreatepublishes an unregistered TODO scaffold without editingcontext.toml.registerandmovedry-run by default;--applyuses path-safety checks, CAS byte comparisons, lossless manifest patching, and recoverablecontext-mutation-journal-v3journals (recovery-compatible withcontext-mutation-journal-v2; unrecognizedpre-v2journals require manual recovery with a matching old version; no--forcebypass). Multi-file replacements are recoverable, never claimed to be physically atomic.syncrefreshes only theAGENTS.mdmanaged block, preserving surrounding user prose and refusing schema mismatches or unfinished transactions.
npx --no-install ty-context validate-context
npx --no-install ty-context doctor [--strict] [--context-file-soft-budget <bytes>] [--context-total-soft-budget <bytes>]validate-contextchecks manifest syntax, registered/default paths,ownspath safety, Unicode NFC and case-fold collisions, symlink boundaries, front-matter consistency, and explicit local dependencies (<!-- ty-context-controlling-source domain="product|technical|design|acceptance|external" path="docs/api.md" -->).doctorreports advisory default-footprint budgets (6 KB per default file and 16 KB total default body, with estimated tokens) and observable startup risks (AGENTS.md> 24,000 bytes,AGENTS.override.md, coexistingGEMINI.md).- Neither command proves factual truth, model compliance, or product correctness—use project tests, runtime observation, and human review.
npx --no-install ty-context upgrade --check
# Stop old host sessions before acknowledging this precondition:
npx --no-install ty-context upgrade --sessions-stoppedAutomatic retirement supports the pinned schema-4 (0.11.0) baseline, preserves exact normalized default body paths, backs up planned edits under tmp/ty-context/upgrade-backups, and retires Long-Task, DSA/DRA, role workflows, and legacy gates. Settle pending schema-4 Context transactions with the compatible 0.11.0 CLI before upgrading, and start a fresh host session afterward. Details: migrations/README.md.
- Temporary exports:
ty-context export-context --help(writes undertmp/ty-context/context-exports/**with secret redaction). - Repository verification:
npm ci,npm run build --workspace project-tiny-context-harness,npm test,node packages/ty-context/dist/cli.js package sync-source,node packages/ty-context/dist/cli.js package check-source.