agentleFS
RedtropigRedtropig/harness-anchor/skills/project-indexing/SKILL.md

project-indexing

Skill13 starsChanged 4 months agoMITView on GitHub

Use when locating files or understanding structure. Consults PROJECT-TOC.md (one-line index per file). Staleness via git commit anchor.

The file

We split this skill into the rules it gives an agent

6 rules. About 0 are common, 3 are distinctive, and 3 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈3

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 3

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Before any Glob '/*.ext' against more than a small directory

    line 14
  2. Distinctive:

    When starting work in an unfamiliar codebase

    line 15
  3. Very specific:

    Check PROJECT-TOC.md exists: If missing, the project is un-indexed.

    line 19
  4. Distinctive:

    Open the file: Only after locating via TOC.

    line 36
  5. Distinctive:

    When you make significant structural changes (new directories, renames, large refactors):

    line 46
  6. Very specific:

    Hard read rule: if PROJECT-TOC.md exceeds ~400 lines, do not read it whole — read the ## Directory map, then Grep the ## Files section for …

    line 82

≈ “Common” is an estimate: at least 1 in 5 of the 213,897 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Project Indexing

PROJECT-TOC.md is the project's machine-friendly index — one line per file, ≤80 chars summary. Reading it is dramatically cheaper than Glob-ing the whole tree.

When to use

  • "Where is X defined?"
  • "Find the file that handles Y"
  • Before any Glob '**/*.ext' against more than a small directory
  • When starting work in an unfamiliar codebase

Reading flow

  1. Check PROJECT-TOC.md exists. If missing, the project is un-indexed. Suggest /index-project and fall back to Glob for the current question.
  2. Check freshness. The TOC header contains:

    <!-- generated-at-commit: <SHA> -->

    Stale if either (both counts exclude PROJECT-TOC.md itself, so committing a regenerated TOC does not re-stale it):

    • git diff --name-only <SHA> HEAD returns files
    • git status --porcelain shows working-tree changes (untracked files count — the TOC doesn't cover them)

    Note: the SessionStart hook already computes toc_stale: true/false and injects it. If stale, prefer /index-project before deep navigation; for one-off questions, fall back to Glob.

  3. Forest before trees. Read the ## Directory map first (one line per directory, with file + subdir counts) to find the right subtree, then grep/scan the ## Files entries under that path. On a large repo the SessionStart hook injects only the directory map (or just its top levels), so the per-file leaves are read on demand.
  4. Open the file. Only after locating via TOC.

When NOT to rely on TOC

  • TOC was just regenerated but agent hasn't seen it (mtime ≠ session start)
  • File you're looking for is new (not yet in git)
  • Question requires content search, not name search (use Grep then)

Rebuilding

When you make significant structural changes (new directories, renames, large refactors):

node ${CLAUDE_PLUGIN_ROOT}/scripts/index-builder.mjs --target .

Or simply tell the user to run /index-project. Don't try to maintain the TOC by hand-editing — it's auto-generated.

TOC format expectations

<!-- generated-at-commit: abc123 -->
<!-- DO NOT EDIT BY HAND — run /index-project or scripts/index-builder.mjs -->

# PROJECT TOC

## Directory map
- `.` (root) — 2 files, 3 subdirs
- `src/` — 1 file, 1 subdir
- `src/util/` — 4 files

## Files
- `src/main.cpp` — entry point, parses CLI args, initializes Engine
- `src/util/log.h` — fmt-based logger
- ...

## Decisions
- 2026-05-15: switched from X to Y (see docs/decisions/0001.md)

The ## Decisions section is human-edited (long-lived architectural notes). The ## Files section is mechanical.

Token economy

PROJECT-TOC.md typically fits within a few thousand tokens even for medium projects. The SessionStart hook adaptively injects the ## Directory map (or, for a small repo, the full ## Files) within the Tier 1 budget — and on a very large repo, only the top-level directories; the rest is read on demand. Don't ask the user to load the full TOC unless the budget allows.

Hard read rule: if PROJECT-TOC.md exceeds ~400 lines, do not read it whole — read the ## Directory map, then Grep the ## Files section for the subtree you need. A full-file Read of a large TOC can spend tens of thousands of tokens on one lookup.

Looking up indexing techniques

For deeper context-engineering / progressive-disclosure indexing approaches not covered here — invoke the docs-lookup skill. The current TOC algorithm is intentionally minimal; refinements (semantic chunks, embeddings) belong in a separate skill.

Typical entry query: progressive disclosure llm agent or agent harness indexing 2026.

Related

  • using-harness-anchor — overall navigation, points here when files are sought
  • feature-state-keeper — manages state files alongside the TOC

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.