Skip to content
/

setup-structure-index

setup-structure-index · shannonbay/setup-structure-index · ★ 15 · last commit 2026-02-09

Primitive shape 2 total
Skills 1 Hooks 1
00

Summary

setup-structure-index — Summary

setup-structure-index is a Claude Code skill that creates and maintains a two-tier structural index of a codebase: a compact file map embedded in CLAUDE.md (zero extra tokens — always loaded), and detailed per-directory YAML files in .claude/structure/ read on demand. A TaskCompleted hook enforces updates only when structural changes occur (files/classes added, removed, or renamed), not on every code edit.

The philosophy is token economics: most exploration savings come from knowing where things are (90% of navigation), not exact method signatures. The Tier 1 file map answers "where is X?" at zero additional cost since CLAUDE.md is already in the system prompt. Tier 2 YAML files answer "what does X export?" and are only read when working in an unfamiliar directory.

Compared to seeds: closest to agent-os (which also writes CLAUDE.md + standards/ files for structural guidance), but setup-structure-index focuses specifically on codebase indexing for navigation efficiency. Unlike claude-conductor (which creates markdown templates for process), setup-structure-index creates machine-readable YAML indexes of code structure.

01

Overview

setup-structure-index — Overview

Origin

Built by shannonbay (GitHub). Very small repo: only README.md and SKILL.md. Released without a license file. 15 stars, last commit 2026-02-09.

Philosophy

Token economics: the old approach of reading 2000 lines of YAML every session wastes tokens because most sessions touch only 1-2 directories. Method signatures are low value — you still need to read source before editing. The two-tier approach provides:

  • Tier 1 (CLAUDE.md file map): 0 extra tokens. One line per source file. Answers "where is X?" — the most common exploration question — instantly.
  • Tier 2 (per-directory YAML): Read only when needed, split by directory. Full export signatures, method params/returns, intra-project imports. ~100-300 lines per directory.
  • TaskCompleted hook: Enforces updates only for structural changes (file/class/function added/removed/renamed). Bug fixes and implementation changes pass through without requiring index updates.

"Old approach: Read ~2000 lines of YAML every session, even for a one-file fix. New approach: Zero extra reads most sessions; ~100-300 lines on demand for deep exploration."

Cost Analysis (From README)

  • Tier 1 reading: 0 extra tokens (embedded in CLAUDE.md)
  • Tier 2 reading: ~100-300 lines per directory, only when needed
  • Initial generation: 50K tokens per module on Haiku ($0.01-0.03)
  • Hook evaluation: 1K tokens per task completion ($0.0001)
  • Updates: only on structural changes, not every code edit

Explicit Antipatterns

  • Reading 1000+ lines of structure YAML to find one function
  • Updating the index on every code edit (instead of only structural changes)
  • Single-tier approach (either too sparse or too verbose)
02

Architecture

setup-structure-index — Architecture

Distribution

  • Type: skill-pack (single SKILL.md file)
  • License: unknown (no LICENSE file in repo)
  • Install complexity: clone-and-configure

Install Commands

# macOS/Linux
git clone https://github.com/shannonbay/setup-structure-index ~/.claude/skills/setup-structure-index

# Windows
git clone https://github.com/shannonbay/setup-structure-index %USERPROFILE%\.claude\skills\setup-structure-index

Directory Layout

README.md    # Full documentation with usage, examples, cost analysis
SKILL.md     # The actual skill with YAML frontmatter + instructions

Created Project Structure

your-project/
├── .claude/
│   ├── settings.json          # TaskCompleted hook added
│   └── structure/
│       ├── backend-controllers.yaml
│       ├── backend-services.yaml
│       └── app-fragments.yaml
└── CLAUDE.md                  # File map + instruction added

Required Runtime

  • Claude Code only (the skill uses Haiku agents for initial generation)

Target AI Tools

  • Claude Code (sole target — uses TaskCompleted hook which is Claude Code specific)
03

Components

setup-structure-index — Components

Skills

Name File Purpose
setup-structure-index SKILL.md Creates two-tier structure index; configures TaskCompleted hook

Hooks

Event Purpose
TaskCompleted Evaluates whether the completed task added, removed, or renamed files/classes/functions. Blocks completion if structural changes occurred without index update.

State Files Created

File Purpose
CLAUDE.md (modified) Adds file map section + instruction to read structure YAMLs
.claude/settings.json (modified) Adds TaskCompleted hook
.claude/structure/*.yaml Per-directory YAML files with export signatures

Tier 2 YAML Format

module: my-backend
directory: controllers/
files:
  auth.ts:
    description: Authentication endpoints
    exports:
      - name: register
        kind: function
        params: [{name: req, type: AuthRequest}, {name: res, type: Response}]
        description: POST /api/auth/register
    imports:
      - from: services/auth.service
        items: [verifyPassword, createUser]

Tier 1 File Map Format (in CLAUDE.md)

### File Map
src/controllers/auth.ts - POST register, login, google, refresh, logout, password reset
src/controllers/users.ts - GET/PATCH/DELETE user profile, avatar upload/download
src/services/auth.service.ts - Auth business logic (password verification, token generation)
05

Prompts

setup-structure-index — Prompt Excerpts

Excerpt 1: Skill Description (YAML frontmatter from SKILL.md)

Technique: Trigger phrase enumeration in description field

---
name: setup-structure-index
description: This skill should be used when the user asks to "set up structure index", "add codebase structure tracking", "create structure files", "set up code structure YAML", or needs to set up the codebase structure index system in a project. It creates a two-tier structure index (compact file map in CLAUDE.md + detailed YAML files) and configures a TaskCompleted hook to enforce updates.
---

Analysis: The description contains a list of exact trigger phrases in quotes, making skill invocation predictable. The description also tells Claude what the skill creates (two artifacts + hook), which sets expectations for the setup steps.


Excerpt 2: Token Economics Rationale (from SKILL.md)

Technique: Quantified cost comparison to justify two-tier design

## Why Two Tiers?

Most of the exploration savings come from knowing *where things are*, not their exact method signatures. A compact file map (~100-200 lines) embedded in CLAUDE.md captures ~70% of the navigation value at zero extra token cost (CLAUDE.md is already loaded into the system prompt). Detailed YAML files with full signatures are only needed when working in an unfamiliar area of the codebase.

**Token economics of the old single-tier approach:**
- Reading a full structure YAML (~1000-2000 lines per module) every session
- Most sessions only touch 1-2 directories, wasting tokens on irrelevant detail

**Token economics of the two-tier approach:**
- Tier 1 (file map in CLAUDE.md): 0 extra tokens (already in system prompt)
- Tier 2 (detailed YAML): read only when needed, split by directory for targeted reads
- Net result: most sessions read 0 extra lines; deep exploration reads ~100-300 lines

Analysis: Quantified token counts (1000-2000 vs 100-300 vs 0) justify the two-tier design. The rationale is included in the skill itself to ensure the agent understands the design intent when setting up the system.


Excerpt 3: Hook Filtering Logic (from SKILL.md)

Technique: Conditional hook trigger with explicit scope definition

### TaskCompleted Hook

A hook that evaluates whether a completed task added, removed, or renamed files/classes. Only triggers updates for structural changes, not every code edit.

The hook evaluation question: "Did this task add, remove, or rename any source files, public classes, or public functions?"
- YES → block completion, update CLAUDE.md file map and relevant structure YAML
- NO → pass through, no update needed

Analysis: The hook's filtering logic is expressed as a binary decision tree, not vague guidance. "Added, removed, or renamed" is the precise trigger condition. "Bug fixes and implementation changes" are explicitly excluded. This prevents hook fatigue from too-frequent triggers.

09

Uniqueness

setup-structure-index — Uniqueness & Positioning

Differs From Seeds

Closest seeds: agent-os (writes CLAUDE.md structural guidance) and ccmemory (persistent memory). But setup-structure-index focuses specifically on codebase navigation efficiency through a two-tier index: the agent-os analogy is weak (agent-os writes standards/, not code structure maps). Unlike ccmemory (which uses Neo4j for knowledge graph memory), setup-structure-index uses plain YAML files with zero infrastructure.

The unique mechanism is the TaskCompleted hook with structural-change filtering: it's the only tool in the corpus that auto-maintains a codebase index by hooking into Claude Code's task completion lifecycle and filtering on structural vs. implementation changes.

Observable Failure Modes

  1. Claude Code only: The TaskCompleted hook doesn't exist in other agents — no portability.
  2. No license file: Licensing unclear — potential adoption risk for enterprise.
  3. Dormant after Feb 2026: No updates in months; compatibility with newer Claude Code versions unconfirmed.
  4. Initial generation cost: ~$0.01-0.03 per module on Haiku for initial setup — not free.
  5. Manual CLAUDE.md editing required: Skill guides Claude to modify CLAUDE.md, but this requires the file to exist.

Distinctive Opinion

Most of the value of a codebase memory system comes from knowing where things are (navigation), not from knowing their full API signatures (detail). A two-tier approach — cheap navigation always loaded, detailed signatures on demand — is the correct balance.

04

Workflow

setup-structure-index — Workflow

Setup Phases

Phase Action Artifact
1. Invocation User says "/setup-structure-index" or "set up structure index" Trigger
2. Create directory mkdir .claude/structure .claude/structure/
3. Generate file map Scan project, generate one-line-per-file map CLAUDE.md section
4. Add instruction Add "read structure YAML" instruction to CLAUDE.md CLAUDE.md update
5. Configure hook Add TaskCompleted hook to .claude/settings.json Hook registered
6. Generate YAML files Use Haiku agents per directory to generate detailed YAML .claude/structure/*.yaml

Hook Behavior (Ongoing)

After setup, every time a task completes:

  1. Hook evaluates: did the task add, remove, or rename any source files or public classes/functions?
  2. If no structural change: hook passes through — no index update required
  3. If structural change: hook blocks completion until CLAUDE.md file map and relevant .claude/structure/*.yaml are updated

Normal Session Flow

New session
  → CLAUDE.md loaded (includes file map) — instant orientation
  → Need to work in controllers/ → read backend-controllers.yaml
  → Add a new endpoint → hook blocks until index updated
  → Fix a bug in existing function → hook passes through

Approval Gates

None — the TaskCompleted hook blocks completion automatically. No explicit user approval gate.

06

Memory Context

setup-structure-index — Memory & Context

Memory Type

File-based, project-scoped. The index IS the memory — it's written to disk and persists across sessions.

Tier 1 Memory (Always-Loaded)

Embedded in CLAUDE.md — loaded automatically by Claude Code on every session. One line per source file with a brief description. Zero additional tokens since CLAUDE.md is already in the system prompt.

Tier 2 Memory (On-Demand)

.claude/structure/*.yaml — detailed per-directory YAML files. Read by the agent only when working in that directory area. Split by directory to limit read size to ~100-300 lines per read.

Memory Persistence

Project-scoped. The index files live in the project repository alongside the code. Cross-session handoff is automatic — no initialization needed on new sessions.

Index Freshness

Maintained by the TaskCompleted hook. The hook enforces index updates only on structural changes (file/class/function additions, deletions, renames). Implementation changes (bug fixes, logic changes) do not trigger an update.

Search Mechanism

None — the index is designed for navigation (where is X?) not search. Users read the file map to find the right directory, then read the YAML for that directory.

07

Orchestration

setup-structure-index — Orchestration

Multi-Agent Pattern

Minimal — the initial YAML generation uses Haiku agents spawned per directory, but this is a one-time setup task, not ongoing orchestration.

Execution Mode

One-shot setup + event-driven enforcement (via TaskCompleted hook).

Hook-Driven Enforcement

The TaskCompleted hook is the ongoing coordination mechanism. It fires after each task and blocks completion if structural index updates are needed.

Isolation Mechanism

None — in-place file editing.

Multi-Model

Yes in the initial setup phase: Haiku agents are used for the detailed YAML generation (cheaper per token, suitable for the mechanical export signature extraction task). The main agent (Claude Code Sonnet) runs the skill and orchestrates the Haiku subagents.

Cross-Tool Portability

Low — the TaskCompleted hook is a Claude Code specific event. Other agents cannot use the hook enforcement mechanism.

08

Ui Cli Surface

setup-structure-index — UI / CLI Surface

CLI Binary

None. Invoked as a Claude Code skill via natural language.

UI / Dashboard

None. Setup and maintenance happen in the Claude Code conversation.

IDE Integration

Claude Code only (the TaskCompleted hook is a Claude Code specific lifecycle event).

Observability

No audit log. Index freshness is observable by reading .claude/structure/*.yaml files directly.

Related frameworks

same archetype · same primary tool · same memory type

MemPalace ★ 53k

Verbatim local-first AI memory with 96.6% R@5 retrieval on LongMemEval using zero API calls — structured into a palace hierarchy…

Beads (Yegge) ★ 24k

Dolt-powered distributed graph issue tracker where AI agents track tasks with hierarchical IDs and dependency edges, claim work…

deepagents (LangChain) ★ 23k

Opinionated Python agent harness on top of LangGraph with sub-agents, filesystem, memory, and context compaction bundled in

agentmemory ★ 18k

Persistent, searchable memory for AI coding agents that captures every tool interaction, compresses it via LLM, and injects…

Open Multi-Agent ★ 6.3k

Give a natural-language goal to a coordinator agent and get a dynamically decomposed, parallelized task DAG executed by…

Basic Memory ★ 3.1k

Gives AI agents a persistent, human-readable knowledge graph of project decisions, observations, and relations stored as plain…