AI Repo Organization Guidelines

This document defines how to organize technical documentation and software folders so agents and developers can work with low context use and high accuracy.

Use this file for organization rules that are broader than one package but more specific than general repository steering.

Purpose

Prototype Expectations

This repository is currently a prototype.

While the repository remains in prototype phase:

Prototype work should optimize for iteration speed without letting durable guidance drift out of date.

Documentation Layers

Use the nearest layer that can state the rule without duplication.

The main split is this:

Humans may read AGENTS.md, but that does not make AGENTS.md the right home for normal repository standards. Keep shared standards outside AGENTS.md unless the rule is primarily about agent workflow.

Layer 1: Agent Behavior Rules

Store agent workflow rules in AGENTS.md files.

Examples:

Use an AGENTS.md file when the rule changes agent behavior, constrains default agent habits, or defines how an agent should apply shared standards while working in the subtree.

Do not use an AGENTS.md file as the primary home for ordinary repository standards that should still be true even when no agent is involved.

Layer 2: Shared Technical Standards

Store cross-cutting implementation and organization standards in shared docs under Documents/technical.

Examples:

These are the main source of truth for repository standards that humans and agents both need.

Use a shared technical document when the rule should apply across multiple packages or documentation areas.

Layer 3: Local Routing Docs

Store local ownership and navigation guidance in the nearest 📌README.md.

Examples:

Use a local routing doc when the information helps a reader decide whether to stay in the folder or leave it.

What Good AI Navigation Looks Like

An agent should be able to answer these questions without broad exploration:

  1. What is this folder for?
  2. Which files are the primary entrypoints?
  3. Which concepts are authoritative here?
  4. What nearby docs should be updated if this area changes?
  5. Is this area active, provisional, or just scaffolded?

If a folder does not answer those questions locally or through one obvious parent document, the documentation is too thin.

Folder Organization Rules

Prefer Stable Responsibility Boundaries

Good examples:

Less useful examples:

Keep Concept Count Low

Create Deeper Local Docs Only When They Save Search Time

Add a new local 📌README.md when a folder has one or more of these properties:

Do not add a local doc just because a folder exists.

Local README Standard

Every significant package or source subfolder should use the same local documentation pattern.

Required Sections

Use these sections in the nearest 📌README.md when the folder has meaningful ownership:

  1. Purpose
  2. Owns
  3. Main entrypoints
  4. Change here when
  5. Do not change here for
  6. Status
  7. Related docs

Section Guidance

Purpose

State what the folder is for in one or two sentences.

Owns

List the concepts, workflows, or artifacts that are authoritative in the folder.

Main entrypoints

Point to the files most likely to matter first.

Change here when

Give concrete edit-routing examples.

Examples:

Do not change here for

Name the nearby concerns that belong somewhere else.

This prevents local edits from drifting across boundaries.

Status

Mark the area with one of these labels:

If a folder mixes statuses, explain the split clearly.

Related docs

Link only the few documents a reader should plausibly open next. If a child-folder link is already maintained by autonav, do not repeat the same target in nearby manual sections unless the duplicate adds clear routing value.

Valid reasons to keep a manual link alongside autonav include:

Nested Folder Docs

When a child folder exists mainly to route readers deeper within an already documented package, keep the child 📌README.md thinner than its parent.

For example, a src folder doc should usually act as a local routing note rather than restating package-level purpose, ownership, status, or policy that already belongs in the parent package README.

Status Markers

Status markers are important because prototypes often mix thin scaffolds with real domain logic.

Do not assume readers can infer maturity from file size or naming.

Change Guard Standard

Use CHANGE-GUARD as the neutral marker for code or documentation that should only be changed intentionally and with explicit approval.

This marker applies to both humans and agents.

Use it sparingly for areas such as:

Recommended form:

/**
 * CHANGE-GUARD
 * Explicit approval required before changing this area.
 * Reason: core domain contract.
 */

Guidance:

Ownership And Update Rules

When code or docs change, update the narrowest document that owns the truth.

Use this rule of thumb:

Update The Nearest Local README When

Update Shared Technical Docs When

Update AGENTS Files When

System Map Guidance

Keep a short system map near the software root.

The system map should list, for each top-level software asset:

Use a small table or short structured list. The goal is fast routing, not deep explanation.

Glossary Guidance

If a package has domain language that is not obvious from file names alone, keep a short glossary near that package.

Use a glossary when:

Keep glossary entries short and authoritative.

Automation Boundary

The markdown maintenance scripts can help preserve documentation structure, but they do not decide semantic truth.

Automation is well-suited for:

Automation is not the source of truth for:

Document these manually in the shared docs and local 📌README.md files.

Documentation Update Checklist

Use this checklist after structural or semantic changes:

  1. Update the nearest local 📌README.md if ownership, entrypoints, scope, or status changed.
  2. Update this document or another shared technical doc if the change establishes a reusable pattern.
  3. Update the nearest applicable AGENTS.md if agents should behave differently after the change.
  4. Run markdown maintenance in the maintained docs scope.
  5. Fix any comment or doc text that points to missing or outdated local guidance.

Review Standard

When reviewing repo organization for AI accuracy, check for these failure modes:

If one of these appears, tighten the nearest owning document instead of adding more scattered notes.