···11+# AGENTS.md
22+33+Status: active
44+Last reviewed: 2026-04-09
55+Owner: Ant maintainers
66+77+This file is the table of contents for agent work in Ant. Start here, then
88+open the smallest linked document that matches the task instead of loading the
99+entire repository into context.
1010+1111+## Start Here
1212+1313+- Repository map: [ARCHITECTURE.md](ARCHITECTURE.md)
1414+- Knowledge index: [docs/repo/index.md](docs/repo/index.md)
1515+- Build setup: [BUILDING.md](BUILDING.md)
1616+- Contribution rules: [CONTRIBUTING.md](CONTRIBUTING.md)
1717+- Durable execution plans: [docs/exec-plans/index.md](docs/exec-plans/index.md)
1818+1919+## Fast Path
2020+2121+- Build from an existing configured tree: `meson compile -C build`
2222+- Fresh local setup: `maid setup`
2323+- Run a focused test file: `./build/ant tests/test_<name>.cjs`
2424+- Run the spec suite: `./build/ant examples/spec/run.js`
2525+- Validate repo knowledge docs: `maid knowledge`
2626+- Validate changed-file boundaries: `maid structure`
2727+- Route the current diff to the right checks: `maid validate_changes`
2828+2929+## Codebase Map
3030+3131+- `src/main.c`, `src/ant.c`, and `src/runtime.c` wire process startup and the
3232+ runtime entrypoints.
3333+- `src/silver/` contains the parser, compiler, VM, and JIT-facing execution
3434+ logic for the Ant Silver engine.
3535+- `src/gc/` contains heap layout, roots, strings, ropes, and collection logic.
3636+- `src/modules/` and `src/builtins/` implement built-in modules and host APIs.
3737+- `src/http/`, `src/net/`, and `src/streams/` are the transport and I/O stack.
3838+- `src/pkg/` is the Zig package manager; `src/strip/` is the Rust type-stripper.
3939+- `meson/` and `meson.build` define the build graph and generated headers.
4040+- `.github/agents/` contains the lightweight repo-harness checks and validation
4141+ router used by local tasks and CI.
4242+- `tests/`, `examples/spec/`, and `tools/wpt/` cover targeted
4343+ runtime tests, the spec suite, and conformance harnesses.
4444+4545+See [ARCHITECTURE.md](ARCHITECTURE.md) for subsystem boundaries and change
4646+guidance.
4747+4848+## Change Rules
4949+5050+- Prefer changes in `src/`, `include/`, `meson/`, `tests/`, `tools/`, and `.github/agents/`.
5151+- Treat `vendor/`, `build/ as generated or third-party surfaces.
5252+ Only edit them when the task explicitly requires it.
5353+- Keep durable design notes and execution history in versioned markdown under
5454+ `docs/`. Treat `todo/` as scratch space, not the source of truth.
5555+- Add or update tests when behavior changes.
5656+- When touching build or runtime invariants, document the reasoning in
5757+ [docs/exec-plans/index.md](docs/exec-plans/index.md) or a linked plan if the
5858+ work spans multiple steps.
5959+6060+## Which Doc To Open Next
6161+6262+- Build, toolchain, or platform issue:
6363+ [BUILDING.md](BUILDING.md)
6464+- Runtime or subsystem question:
6565+ [ARCHITECTURE.md](ARCHITECTURE.md)
6666+- Test selection or validation scope:
6767+ [docs/repo/testing.md](docs/repo/testing.md)
6868+- Long-running or multi-step task:
6969+ [docs/exec-plans/index.md](docs/exec-plans/index.md)
7070+7171+## Keep This File Small
7272+7373+`AGENTS.md` should stay a concise entrypoint. Add durable detail to the linked
7474+documents instead of expanding this file into a manual.
+83
ARCHITECTURE.md
···11+# Architecture
22+33+Status: active
44+Last reviewed: 2026-04-09
55+Owner: theMackabu
66+77+This document is the top-level map for Ant's runtime and build graph. It is
88+meant to answer "where should this change live?" before anyone starts editing.
99+1010+## Design Priorities
1111+1212+- Keep the runtime small and fast to start.
1313+- Prefer explicit, in-repo implementations over opaque build-time magic.
1414+- Isolate third-party code under `vendor/` and keep Ant-owned logic in `src/`,
1515+ `include/`, `meson/`, `tools/`, and `tests/`.
1616+1717+## Runtime Layers
1818+1919+### Process and startup
2020+2121+- `src/main.c` is the CLI executable entrypoint.
2222+- `src/ant.c` and `src/runtime.c` handle runtime initialization and shared
2323+ process setup.
2424+- `src/cli/` contains command-line specific behavior such as version and package
2525+ commands.
2626+2727+### JavaScript engine
2828+2929+- `src/silver/` contains the language pipeline: lexer, parser, compiler,
3030+ directives, VM glue, and bytecode operations.
3131+- `src/gc/` contains memory management primitives and object/string handling.
3232+- Files like `src/errors.c`, `src/descriptors.c`, and `src/shapes.c` support
3333+ core engine behavior shared across subsystems.
3434+3535+### Host platform surface
3636+3737+- `src/modules/` implements built-in modules and runtime-facing JS APIs.
3838+- `src/builtins/` holds bundled JavaScript shims and Node-compatible modules.
3939+- `src/http/`, `src/net/`, and `src/streams/` provide protocol, networking, and
4040+ streaming support.
4141+- `src/esm/` handles module loading, export wiring, and built-in bundle access.
4242+4343+### Tooling and generated inputs
4444+4545+- `src/tools/` generates bundled sources such as the builtin bundle and JS
4646+ snapshot.
4747+- `src/core/` stores TypeScript sources and runtime metadata that feed
4848+ generation steps.
4949+- `src/pkg/` is the Zig package manager.
5050+- `src/strip/` is the Rust type-stripper used during builds.
5151+- `meson/` and the root [meson.build](meson.build) describe the build graph,
5252+ dependency setup, and custom code generation targets.
5353+5454+## Tests and Validation
5555+5656+- `tests/` contains focused runtime tests.
5757+- `examples/spec/` is the main spec regression suite.
5858+- `test262/`, and `tools/wpt/` support broader conformance and standards work.
5959+- See [docs/repo/testing.md](docs/repo/testing.md) for the recommended command
6060+ set by change type.
6161+6262+## Change Placement Guidelines
6363+6464+- Parser, bytecode, execution semantics, or JIT-adjacent work belongs under
6565+ `src/silver/`.
6666+- Heap, string, or lifetime bugs usually belong under `src/gc/`.
6767+- Built-in API behavior should land in `src/modules/`, `src/builtins/`, or
6868+ `src/esm/` depending on whether the change is C runtime code, bundled JS, or
6969+ module-loader plumbing.
7070+- Networking and protocol work should stay in `src/http/`, `src/net/`, or
7171+ `src/streams/` unless it is only wiring.
7272+- Build graph changes should prefer `meson/` or `meson.build`; avoid burying
7373+ build logic in ad-hoc shell scripts.
7474+7575+## Boundaries To Preserve
7676+7777+- Do not hand-edit third-party code in `vendor/` unless the task is explicitly a
7878+ vendored dependency change.
7979+- Do not check durable architecture knowledge into `todo/`; use
8080+ [docs/exec-plans/index.md](docs/exec-plans/index.md) for multi-step work and
8181+ `docs/repo/` for stable reference docs.
8282+- Keep generated outputs reproducible. If a generated file changes, update or
8383+ document the generator path in the same change.
+13
CONTRIBUTING.md
···2020For detailed build instructions including debug builds, ASan builds, <br>
2121ccache setup, and Windows/Linux/macOS specifics, see [BUILDING.md](BUILDING.md).
22222323+## Repository Knowledge
2424+2525+Ant keeps agent-facing repository context in versioned markdown so future
2626+changes do not depend on chat history or tribal knowledge.
2727+2828+- Start with [AGENTS.md](AGENTS.md) for the quick repository map
2929+- Use [ARCHITECTURE.md](ARCHITECTURE.md) for subsystem boundaries
3030+- Use [docs/repo/index.md](docs/repo/index.md) for durable workflow docs
3131+- Use [docs/exec-plans/index.md](docs/exec-plans/index.md) for multi-step work
3232+- Run `maid knowledge` after updating these docs
3333+- Run `maid structure` to catch generated-path and scratch-doc violations
3434+- Run `maid validate_changes` to see the recommended validation set for the current diff
3535+2336## How to Contribute
24372538### Reporting Bugs
+17
docs/exec-plans/active/README.md
···11+# Active Plans
22+33+Status: active
44+Last reviewed: 2026-04-09
55+Owner: theMackabu
66+77+Store in-progress execution plans here.
88+99+Recommended sections:
1010+1111+- Goal
1212+- Scope
1313+- Constraints
1414+- Task list
1515+- Decision log
1616+- Validation status
1717+- Follow-ups
+9
docs/exec-plans/completed/README.md
···11+# Completed Plans
22+33+Status: active
44+Last reviewed: 2026-04-09
55+Owner: theMackabu
66+77+Move finished execution plans here once the associated work has landed. Keep
88+the final validation notes and follow-up references intact so future changes
99+can reuse the decision history.
+31
docs/exec-plans/index.md
···11+# Execution Plans
22+33+Status: active
44+Last reviewed: 2026-04-09
55+Owner: theMackabu
66+77+Use this directory for durable, versioned plans when work spans multiple
88+decisions, checkpoints, or follow-up changes.
99+1010+## Layout
1111+1212+- Active plans: [active/README.md](active/README.md)
1313+- Completed plans: [completed/README.md](completed/README.md)
1414+- Technical debt tracker: [tech-debt.md](tech-debt.md)
1515+1616+## When To Create A Plan
1717+1818+- The task spans multiple subsystems.
1919+- The work will happen across multiple commits or pull requests.
2020+- Validation has meaningful risk, tradeoffs, or deferred follow-ups.
2121+- Future contributors will need the reasoning, not just the final diff.
2222+2323+## Plan Expectations
2424+2525+- State the problem, constraints, and intended outcome up front.
2626+- Keep a short decision log as the work evolves.
2727+- Record validation status and unresolved risks.
2828+- Move finished plans into `completed/` once the work is done.
2929+3030+`todo/` can still hold scratch notes, but durable execution history belongs in
3131+this directory.
+17
docs/exec-plans/tech-debt.md
···11+# Technical Debt Tracker
22+33+Status: active
44+Last reviewed: 2026-04-09
55+Owner: theMackabu
66+77+Use this file to record debt that is important enough to preserve but not yet
88+scheduled.
99+1010+## Format
1111+1212+- Area:
1313+- Issue:
1414+- Impact:
1515+- Proposed fix:
1616+- Owner:
1717+- Status:
+36
docs/repo/index.md
···11+# Repo Knowledge Index
22+33+Status: active
44+Last reviewed: 2026-04-09
55+Owner: theMackabu
66+77+This directory is the durable, versioned knowledge base for Ant's repository
88+workflow. Start with the smallest document that answers the task at hand.
99+1010+## Core References
1111+1212+- Agent entrypoint: [../../AGENTS.md](../../AGENTS.md)
1313+- Architecture map: [../../ARCHITECTURE.md](../../ARCHITECTURE.md)
1414+- Build instructions: [../../BUILDING.md](../../BUILDING.md)
1515+- Contribution guide: [../../CONTRIBUTING.md](../../CONTRIBUTING.md)
1616+- Test selection guide: [testing.md](testing.md)
1717+- Execution plans and tech debt: [../exec-plans/index.md](../exec-plans/index.md)
1818+1919+## How To Use This Knowledge Base
2020+2121+- Keep stable reference material here instead of burying it in chat history or
2222+ scratch notes.
2323+- Use execution plans for work that spans multiple commits, decisions, or
2424+ checkpoints.
2525+- Keep `AGENTS.md` short and link into this directory rather than expanding it.
2626+- Run `maid knowledge` after updating these docs so stale links or missing
2727+ metadata fail fast.
2828+- Run `maid structure` to guard changed-file boundaries.
2929+- Run `maid validate_changes` to route the current diff to the smallest safe
3030+ validation set.
3131+3232+## When To Add A New Doc
3333+3434+- Add a new document when a rule, subsystem map, or workflow is reused across
3535+ tasks and would otherwise be repeated in prompts or review comments.
3636+- Prefer one focused file per topic over a single large manual.
+45
docs/repo/testing.md
···11+# Testing Guide
22+33+Status: active
44+Last reviewed: 2026-04-09
55+Owner: theMackabu
66+77+This guide keeps validation proportional to the change while still protecting runtime behavior.
88+99+## Common Commands
1010+1111+- Build the configured tree: `maid build`
1212+- Fresh setup and build: `maid setup && maid build`
1313+- Run one runtime test: `./build/ant tests/test_<name>.cjs`
1414+- Run the spec suite: `./build/ant examples/spec/run.js --all`
1515+- Validate repo knowledge docs: `maid knowledge`
1616+- Validate changed-file boundaries: `maid structure`
1717+- Ask the harness what to run for the current diff: `maid validate_changes`
1818+1919+## Validation By Change Type
2020+2121+### Runtime behavior in `src/modules/`, `src/esm/`, or `src/builtins/`
2222+2323+- Run the most specific `tests/test_<name>.cjs` coverage you can find or add.
2424+- Run `./build/ant examples/spec/run.js <spec_name>` when the change affects shared runtime
2525+ semantics or built-ins used broadly across the platform.
2626+2727+### Engine behavior in `src/silver/`, `src/gc/`, or runtime core files
2828+2929+- Rebuild with `maid build`.
3030+- Run focused regression tests first.
3131+- Run `./build/ant examples/spec/run.js --all` before landing behavior changes.
3232+3333+### Build or toolchain changes
3434+3535+- Re-run the affected Meson flow (`maid setup`, `maid reconfigure`, or
3636+ `maid build`).
3737+- Validate any new repo-knowledge or workflow checks locally with
3838+ `maid knowledge` and `maid structure`.
3939+4040+## Notes
4141+4242+- Keep new tests close to the behavior they protect so future agent runs can
4343+ discover the expected pattern quickly.
4444+- If the right validation is expensive or unavailable, document the gap in the
4545+ associated [execution plan](../exec-plans/index.md).