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
- Resolve the target repository and determine whether it is new or existing.
- If
repository-variables.jsonexists, 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. - 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.
- If
AUTHOR.mdexists, read it and compare it withrepository-variables.json. Ask only about missing or conflicting facts. Do not silently inherit identity from a template or source repository. - For an existing repository, inspect its files, Git status, documentation,
manifests, tests, host configuration, and any
AGENTS.mdor equivalent instructions. Preserve unrelated user changes. - Infer the most suitable profile: documentation/guide, skill/workflow, software/automation, dataset, or a justified custom minimum.
- Determine whether the repository is content-heavy. Recommend
content-index.jsonwhen it contains recurring updates, articles, research entries, policies, guides, or enough individual documents that listing each one inrepository.jsonwould make the repository manifest cumbersome. Keep small repositories onrepository.jsonalone. - Separate facts found in the repository from assumptions and recommendations.
- 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, orleave 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:
- Update the same plan.
- Increment the plan revision.
- Set status to
awaiting approval. - 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
- Reinspect Git status and relevant files to detect changes since planning.
- Mark the current revision
approvedwith the approval evidence. - Apply only approved actions.
- Merge with useful existing content. Do not overwrite complete documentation, manifests, licenses, CI, host configuration, or agent instructions merely to match a template.
- Create only relevant folders and files. Avoid empty ceremonial structure.
- 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.mdfor future notes and proposals, while keeping completed versioned changes inCHANGELOG.md. - create
AUTHOR.mdas the canonical human-readable attribution file and keep it aligned withrepository-variables.json,repository.json,CITATION.cff, andLICENSE. - create or update
repository-variables.jsonwith verified stable identity, repository, rights, profile, and workflow defaults; add it to agent read order beforerepository.json. Omit optional unknown values or usenullwhere the schema permits; never invent an organization. - for an approved content-heavy repository, create
content-index.jsonas the compact catalog of individual authoritative documents. Declare it inrepository.json, keep document paths repository-relative, use stablecontent_idvalues, and do not copy full document bodies into the index. Do not add chunk IDs, knowledge IDs,chunks.json, orqa.jsonmerely because a document is cataloged.
- explain purpose, audience, inputs, outputs, setup, usage, validation, version, and license in
- 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.
- Do not create commits, branches, remotes, releases, or hosting-platform settings unless the user separately requested them.
Phase 5: Validate and record
- Run
scripts/audit_repository.pywith the approved profile. - Parse machine-readable files and check
repository-variables.jsonalignment, version alignment, internal paths, and declared entry points. Whencontent-index.jsonexists, check unique content IDs, unique paths, indexed-file existence, and related-content references. - Run relevant repository-native tests, linters, schema checks, and link checks that can safely run.
- Search created examples and receipts for secrets, personal data, and organization-specific residue.
- Confirm that
UPDATES.mdcontains future planning notes only and is not presented as approval or completed work. - 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.jsonsource; - 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.