Files
2026-07-24 16:17:28 -06:00

8.5 KiB

name, description
name description
structure-ai-ready-repository Assess, plan, create, or correct a new or existing repository so humans and AI agents can discover, understand, validate, and reuse it. Use when a user asks to start a repository with an AI-ready structure, audit or reorganize an existing repository, add machine-readable repository metadata, improve agent entry points, standardize repository documentation, or apply the general AI-ready repository template. By default, create a repository-local task plan for review and require explicit approval before implementing structural changes; bypass the plan only when the user explicitly authorizes immediate implementation.

Structure an AI-Ready Repository

Create the smallest repository structure that makes the project clear to humans and AI agents. Preserve useful existing conventions and content.

Load the standard

Read references/repository-structure-standard.md before proposing a structure. Treat it as a menu and decision standard, not a command to create every listed file.

Use assets/repository-structure-plan-template.md for the required review artifact.

Use scripts/audit_repository.py for a read-only baseline and final structural check. Do not treat the script as a substitute for inspecting repository purpose, existing instructions, or project-native tests.

Phase 1: Inspect

  1. Resolve the target repository and determine whether it is new or existing.
  2. If repository-variables.json exists, read it before the identity round. Treat values with a verification source and date as defaults. Ask only about missing, conflicting, explicitly unverified, or user-overridden values.
  3. Begin with a short identity and publication round. Ask only for values the user has not already supplied or verified:
    • author or authors;
    • publisher and maintainer;
    • canonical repository URL;
    • intended license.
  4. If AUTHOR.md exists, read it and compare it with repository-variables.json. Ask only about missing or conflicting facts. Do not silently inherit identity from a template or source repository.
  5. For an existing repository, inspect its files, Git status, documentation, manifests, tests, host configuration, and any AGENTS.md or equivalent instructions. Preserve unrelated user changes.
  6. Infer the most suitable profile: documentation/guide, skill/workflow, software/automation, dataset, or a justified custom minimum.
  7. Determine whether the repository is content-heavy. Recommend content-index.json when it contains recurring updates, articles, research entries, policies, guides, or enough individual documents that listing each one in repository.json would make the repository manifest cumbersome. Keep small repositories on repository.json alone.
  8. Separate facts found in the repository from assumptions and recommendations.
  9. Run the read-only audit when Python is available. Record failures as planning inputs, not as permission to change files.

Phase 2: Write the review plan

Create exactly one active plan at:

tasks/<task-id>/repository-structure-plan.md

Use lowercase kebab-case for <task-id>, normally structure-ai-ready-repository.

For a new repository, creating the target directory and this task-plan path is the only pre-approval repository write allowed. For an existing repository, do not modify anything outside the task folder before approval.

The plan must include:

  • target and current state;
  • selected repository profile and rationale;
  • proposed tree;
  • a file action table using create, preserve, modify, move, deprecate, or leave absent;
  • purpose and planned content for every created or modified file;
  • existing-content preservation and migration notes;
  • host-specific choices;
  • validation commands and definition of done;
  • risks, assumptions, open questions, and out-of-scope work;
  • approval status and plan revision.

Use move or deprecate only when necessary. Never propose deletion as an implied cleanup step.

Present the plan to the user and stop. Ask the user to approve it or request amendments. Do not implement in the same turn that first creates the plan.

Phase 3: Amend or approve

When the user requests changes:

  1. Update the same plan.
  2. Increment the plan revision.
  3. Set status to awaiting approval.
  4. Summarize the amendments and stop for review again.

Proceed only after the user explicitly approves the current revision. Approval must clearly refer to the plan or proposed structure. Questions, partial agreement, silence, or approval of an older revision do not authorize implementation.

If implementation requires a material departure from the approved plan, update the plan, explain the change, and return to awaiting approval.

Phase 4: Implement the approved plan

  1. Reinspect Git status and relevant files to detect changes since planning.
  2. Mark the current revision approved with the approval evidence.
  3. Apply only approved actions.
  4. Merge with useful existing content. Do not overwrite complete documentation, manifests, licenses, CI, host configuration, or agent instructions merely to match a template.
  5. Create only relevant folders and files. Avoid empty ceremonial structure.
  6. Keep human and AI entry points explicit:
    • explain purpose, audience, inputs, outputs, setup, usage, validation, version, and license in README.md;
    • identify authoritative files and retrieval order in repository.json;
    • provide scoped agent instructions in the repository's established agent-instruction file;
    • index skills, scripts, templates, schemas, data, and examples when they exist.
    • create or update UPDATES.md for future notes and proposals, while keeping completed versioned changes in CHANGELOG.md.
    • create AUTHOR.md as the canonical human-readable attribution file and keep it aligned with repository-variables.json, repository.json, CITATION.cff, and LICENSE.
    • create or update repository-variables.json with verified stable identity, repository, rights, profile, and workflow defaults; add it to agent read order before repository.json. Omit optional unknown values or use null where the schema permits; never invent an organization.
    • for an approved content-heavy repository, create content-index.json as the compact catalog of individual authoritative documents. Declare it in repository.json, keep document paths repository-relative, use stable content_id values, and do not copy full document bodies into the index. Do not add chunk IDs, knowledge IDs, chunks.json, or qa.json merely because a document is cataloged.
  7. Use placeholders only when the user has not supplied a value and the placeholder is visibly marked. Never invent URLs, maintainers, licenses, security contacts, provenance, or credentials.
  8. Do not create commits, branches, remotes, releases, or hosting-platform settings unless the user separately requested them.

Phase 5: Validate and record

  1. Run scripts/audit_repository.py with the approved profile.
  2. Parse machine-readable files and check repository-variables.json alignment, version alignment, internal paths, and declared entry points. When content-index.json exists, check unique content IDs, unique paths, indexed-file existence, and related-content references.
  3. Run relevant repository-native tests, linters, schema checks, and link checks that can safely run.
  4. Search created examples and receipts for secrets, personal data, and organization-specific residue.
  5. Confirm that UPDATES.md contains future planning notes only and is not presented as approval or completed work.
  6. Create:
tasks/<task-id>/implementation-receipt.md
tasks/<task-id>/validation-results.md

Record the approved revision, actual actions, deviations, commands, results, unresolved issues, and rollback guidance. Set the plan status to implemented only when approved work is complete.

Final report

Report:

  • the verified author, publisher, maintainer, canonical URL, license, and repository-variables.json source;
  • the selected profile and resulting entry points;
  • created, modified, preserved, moved, and intentionally omitted files;
  • validation results and anything not tested;
  • deviations from the approved plan;
  • remaining human decisions;
  • task-plan and receipt locations.

Do not describe the repository as compliant merely because expected filenames exist. Content, links, metadata, and instructions must agree with the actual project.