project-tiny-context-harness
Health Uyari
- License — License: MIT
- Description — Repository has a description
- Active repo — Last push 0 days ago
- Low visibility — Only 7 GitHub stars
Code Uyari
- process.env — Environment variable access in .github/workflows/npm-publish.yml
- fs module — File system access in .github/workflows/npm-publish.yml
Permissions Gecti
- Permissions — No dangerous permissions requested
Bu listing icin henuz AI raporu yok.
Repo-native project memory for coding agents (Claude Code, Codex, Cursor, Antigravity) — ~500-token AGENTS.md & L0-L3 path routing.
What Is Tiny Context?
Tiny Context is a tiny plain-text file layout (plus an optional CLI) that keeps your project's non-code knowledge—goals, "do not touch" boundaries, key decisions, and test commands—inside Git so every new Claude Code, Codex, Cursor, Antigravity, Gemini CLI, or OpenCode session stays on track without bloating AGENTS.md.
Instead of stuffing everything into one giant rules file or running a vector database, your repo simply looks like this:
your-repo/
├── AGENTS.md # Tiny (~500 tokens) startup guide shared by all coding agents
└── project_context/
├── global.md # Project goals, non-goals, and core verification commands
├── context.toml # Optional map: which doc covers which code folder
└── payments.md # Optional module doc — loaded only when touching src/payments/**
- Plain Markdown + TOML in Git: works offline, zero database, zero background daemon, zero LLM API calls.
- Tool-neutral: one shared memory folder across coding agents, teams, and CI (and you can edit the Markdown in any IDE—or even Obsidian).
- Optional CLI (
ty-context): finds which docs cover a file orgit diff, checks broken paths, and warns when your startup docs get too large.
Quick Start
1. Initialize in your repo (Node.js 24+)
npm install --save-dev project-tiny-context-harness
npx --no-install ty-context init
That creates only 4 files: AGENTS.md, .agent/config.yaml, project_context/global.md, and project_context/context.toml. No skills, hooks, Makefiles, or CI workflows are added.
- Existing repository: add
--adopt(npx --no-install ty-context init --adopt). - Pick a host config folder (project memory still stays shared in
project_context/**):npx --no-install ty-context init --harness-folder .agents # Antigravity (AGY) npx --no-install ty-context init --harness-folder .claude # Claude Code npx --no-install ty-context init --harness-folder .codex # Codex npx --no-install ty-context init --harness-folder .cursor # Cursor npx --no-install ty-context init --harness-folder .gemini # Gemini CLI npx --no-install ty-context init --harness-folder .opencode # OpenCode / Cline / Roo - Python / Go / Rust / no
package.json: you do not have to install anything—just keepAGENTS.md,project_context/global.md, andproject_context/context.tomlin Git. Whenever you want to run checks or diff routing, run one-off commands withnpx:npx --yes project-tiny-context-harness validate-context npx --yes project-tiny-context-harness doctor npx --yes project-tiny-context-harness context for --git-diff
2. Write 5–10 lines of real project rules in project_context/global.md
Only write things a fresh agent cannot easily guess from code alone:
# Payments Service
- Goal: process checkout charges and refunds safely without duplicate billing.
- Boundaries: never hand-edit files under `generated/`; do not shorten webhook retry intervals (provider rate-limit incident #412).
- Verification: run `npm test -- payments` after changes; run `npm run smoke:webhook` before release.
3. Start a new agent chat & verify
Ask a fresh Claude Code / Codex / Cursor / Antigravity session:
Read AGENTS.md and project_context/**, then summarize our goals, boundaries, and test commands before editing any code.
Everyday Commands
Once your repo grows beyond a few docs and you add module entries to project_context/context.toml, these 4 commands cover daily use:
# 1. See all memory docs and their estimated token counts
npx --no-install ty-context context list --index
# 2. Find which docs govern a specific file you are about to edit
npx --no-install ty-context context for src/payments/refund.ts
# 3. Before committing or opening a PR, see which docs cover your git diff
npx --no-install ty-context context for --git-diff # working tree + untracked
npx --no-install ty-context context for --staged # staged changes (pre-commit)
npx --no-install ty-context context for --base main # branch changes (CI / PR)
# 4. Check for broken paths, case collisions, and oversized startup docs
npx --no-install ty-context validate-context
npx --no-install ty-context doctor
Examples
Want to see what a real setup looks like without installing anything?
- Tiny standalone sample: examples/minimal-context-sample/ — a small issue-labeling repo showing how fresh sessions recover a "suggest labels only, never mutate GitHub" rule (walkthrough).
- This repository itself: AGENTS.md · project_context/global.md · project_context/context.toml.
How It Works (Under the Hood)
Tiny Context splits project memory into 4 layers by change frequency so fresh sessions read only what a task touches:
| Layer | File | When it's loaded | What goes here |
|---|---|---|---|
| L0 | AGENTS.md (managed block) |
Always (~500 tokens) | Short read/write contract and evidence/authorization boundaries |
| L1 | project_context/context.toml |
When locating docs | Compact map binding code folder globs (owns) to owning docs |
| L2 | project_context/**/*.md |
Only matched/default docs | Settled goals, non-goals, decision rationale, boundaries, test entrypoints |
| L3 | Code, tests, design specs | On demand while coding | Exact implementation values, API contracts, adopted design prototypes |
Mapping Code Folders to Docs (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/**"]
Real output measured on this repository (10 memory docs totaling ~4,296 estimated tokens — editing init.ts matches just 2 owning docs, ~1,025 tokens / 24%):
$ npx --no-install ty-context context for packages/ty-context/src/lib/init.ts
Matched Context owners (2):
project_context/areas/harness-package/contracts/package-managed-surfaces.md [on-demand; owns:packages/ty-context/src/lib/init.ts] (~558t) — Managed asset sync, init/sync boundaries, skill command retirement, and schema-4 retirement
project_context/areas/harness-package.md [default; area_root:packages/ty-context] (~467t) — Package CLI scope, schema-5 maintenance boundaries, and distribution ownership
When to layer vs. keep it flat: For small repos (3–5 docs well under the 16 KB default budget), keep them in defaults and read in one turn instead of adding extra tool-call hops. Split into
on-demand+ownsonce module docs grow, and use RAG/code-search for massive enterprise wikis or open-ended queries (full trade-offs & FAQ).
Why This Design?
Four simple choices hold the whole design together:
- Narrow scope: store only settled, non-code facts for one repo (never cross-project notes or task logs). Because the set stays small, module ownership is cheap to enumerate explicitly.
- Deterministic read & write:
ownsfolder prefixes route directly to the right doc without guessing keywords or running embeddings, and--git-diffreminds you which single owner doc to check when code changes. - Soft size guardrails:
doctorflags oversized startup/default files (6 KB per default file, 16 KB default total, 24 KBAGENTS.mdtruncation risk, plus shadowingAGENTS.override.md/GEMINI.md). - Honest boundaries:
validate-contextanddoctorcheck structural recoverability only—never factual truth, model compliance, or unverified speedup claims (evidence boundary). Tests, CI, and human review still own quality.
How It Compares
| Approach | Strength | Trade-off vs. Tiny Context |
|---|---|---|
Single AGENTS.md / docs/ |
Zero setup for tiny repos | Bloats quickly past 10–24 KB, burns startup tokens, or lacks deterministic path-to-doc routing |
| Obsidian / Notion (with or without MCP) | Great personal cross-project vault & GUI (you can even edit project_context/ in Obsidian) |
Built to accumulate across projects rather than enforce narrow repo scope, owns routing, size budgets, or tool-neutral CI checks |
IDE-specific rules (CLAUDE.md, .cursor/rules, GEMINI.md) |
Native auto-injection per tool | Tied to one vendor; duplicates drift immediately when mixing tools |
| Heavy spec / workflow kits | Full PRD → Plan → Task templates | High authoring/maintenance ceremony; accumulates per-task artifacts |
| Code search / LSP / RAG / MCP memory | Essential for huge codebases, enterprise wikis, and open-ended search | Complementary: RAG trades deterministic recall for bounded lookup over huge corpora, while Tiny Context guarantees must-not-miss repo invariants |
See the full Comparison Guide and FAQ.
Documentation
| Topic | Guide |
|---|---|
| Multi-tool setup (Antigravity, Claude Code, Codex, Cursor, Gemini CLI, OpenCode) | Agent Surface Recipes |
| Adopting an existing repository | Adopt Existing Repo |
| Full comparison & FAQ | Comparison · FAQ |
| Design principles & product spec | Design Principles · Product Spec |
Referencing design prototypes (ty-context-controlling-source) |
Design Resources Guide |
| Benchmarking & evidence boundary | Benchmarking & Evidence |
| Release history & migrations | Changelog · Migration Notes |
| Optional companion workflow skills | project-workflow-skills |
Advanced Maintenance, Safe File Transactions, Upgrading & Source Development
- Source version:
0.14.1| Schema:5(upgrade-requiredfrom schema 4)
Safe File Maintenance & Sync
# Create, register, and move Context files with dry-run previews and recoverable journals
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
# Refresh only the AGENTS.md managed block without touching your prose
npx --no-install ty-context sync
# Strict budget check / custom soft budgets
npx --no-install ty-context doctor [--strict] [--context-file-soft-budget <bytes>] [--context-total-soft-budget <bytes>]
- Recoverable file mutations:
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 writes are recoverable rather than claimed to be physically atomic). - Explicit local design/spec pointers: declare local UTF-8 dependencies inside Context docs via
<!-- ty-context-controlling-source domain="product|technical|design|acceptance|external" path="docs/api.md" -->and verify them withvalidate-context. - Offline fallback: all discovery commands also support
--json(--default,--index,--query,--with-defaults,context inspect <path>). Invalid manifests exit non-zero—a failed query is reported as incomplete, never silently empty.
Upgrading from 0.13.x (Companion Workflow Skills Decoupled)
In 0.14.0, cross-project workflow skills (solution-research, design-resource, durable-goal, development-execution, handoff) moved to the standalone global plugin repository project-workflow-skills.
ty-context skillis retired in0.14.0and exits non-zero with migration guidance.- Upgrading from
0.13.xissync-only:init,sync, andupgradenever delete any existing project skills directory.
Explicit Schema-4 Upgrade (<= 0.11.0)
npx --no-install ty-context upgrade --check
# Stop old host sessions before acknowledging this precondition:
npx --no-install ty-context upgrade --sessions-stopped
Automatic 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 & Contributor Verification
- Temporary redacted exports:
npx --no-install ty-context export-context --help(writes undertmp/ty-context/context-exports/**). - For an unreleased checkout, build and install its local tarball rather than assuming the published package matches source.
- 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.
Yorumlar (0)
Yorum birakmak icin giris yap.
Yorum birakSonuc bulunamadi