name: hs-init-project
description: Bootstrap Codex-oriented repository structure for both brand-new and already-existing projects. Use when Codex needs to initialize or retrofit root and local AGENTS.md files, a root-level rule/ directory with rule/index.md and rule/rules/*.md, human-facing docs structure, a single source-root plus non-runtime boundary model, and GitHub repository workflow policy without guessing ambiguous structural decisions or destructively rewriting existing project contents.
Init Project
Critical First Turn
If no valid language selection is already present in the current request or session, the very first user-facing response must be exactly this plain-text message:
1. English
2. Korean(한국어)
Do not add any other text. Do not request a chooser, submit dialog, modal, or any other structured selection UI. Do not inspect the repository first. Do not read templates first. Do not send progress updates first. After printing the two lines, stop and wait for the answer. Do not repeat the same question unless the user starts a new attempt.
Overview
Initialize repository structure from the real current state, not from assumptions. Support two modes: full initialization for near-empty repositories, and additive Codex-structure initialization for repositories that already contain source code, directories, or documentation.
Every initialized repository must include adaptive harness support for planner / generator / evaluator, cycle-backed working docs under subagents_docs/, and a minimal starter local skill set under .codex/skills/ as part of the baseline structure without changing the underlying README/rule/docs model.
Every initialized repository must also include root PROJECT_OVERVIEW.md as the project-wide requirements specification and subagents_docs/roadmap.md as the phase roadmap with required completion checklists and phase gates.
Read references/language-output.md before generating any user-facing document.
Read references/structure-initialization.md for the detailed structural requirements, including PROJECT_OVERVIEW.md and roadmap generation.
Read references/subagent-orchestration.md before generating the adaptive subagent harness.
Use scripts/materialize_repo.sh as a materialization step after inspection and clarification, not as a substitute for asking questions.
In existing repositories or uncertain structures, inspect first, ask the missing questions, then rerun the generator with resolved inputs.
Workflow
- Check whether the language is already fixed first.
- If no valid language selection is already present, ask this plain-text question before any other clarification:
1. English 2. Korean(한국어) - If no valid language selection is already present, the entire next user-facing message must be exactly those two lines and nothing else.
- After printing the language question, stop and wait for the answer.
- Do not inspect the repository, read templates, or emit progress updates before the language is fixed.
- Keep the prompt plain text only. Do not request or describe a chooser, submit UI, dummy confirmation, or any other structured selection widget.
- If the current request already includes a valid language selection such as
1,2,English, orKorean(한국어), do not ask again. - After a valid selection is made, do not repeat the question in the same session.
- If the environment is non-interactive and no answer can be collected, ask once and stop instead of repeating the same prompt.
- Use the selected language for generated documentation,
subagents_docs/working documents, and all later clarification questions.
- If no valid language selection is already present, ask this plain-text question before any other clarification:
- Classify the user intent before entering the implementation cycle.
- If the user is asking for analysis, questions, review, explanation, comparison, or other non-implementation guidance, do not materialize files and do not enter implementation flow.
- Start the implementation cycle only when the user explicitly requests initialization, creation, change, update, fix, or materialization, or when the task unambiguously requires repository changes.
- If the implementation intent is ambiguous, ask or answer analytically instead of guessing and editing files.
- Inspect the repository before changing anything.
- Check whether the project is effectively empty or already has meaningful structure.
- Look for existing source directories, docs, AGENTS-like files, rule docs, and whether there is already a clear single source-root plus non-runtime boundary.
- Inspect the remote default branch and active GitHub protection system before changing workflow policy.
- Stop on structural ambiguity by asking, not by abandoning the run.
- If directory semantics, runtime boundaries, naming boundaries with existing directories, incorporation of existing
docs/orrule/trees, or overwrite of existing control files are unclear, ask minimal clarification questions and wait. - Do not guess high-impact structure decisions.
- Do not produce partial final structure when core structural decisions are unresolved.
- Do not surface raw generator ambiguity as a final failure when the missing decision can be resolved by asking the user.
- If directory semantics, runtime boundaries, naming boundaries with existing directories, incorporation of existing
- Choose the operating mode.
- Fresh mode: create the full base structure from scratch.
- Existing-project mode: add Codex-compatible structure around the existing repository without arbitrary moves, renames, or destructive edits.
- In existing-project mode, prefer an inspect pass first. Use
scripts/materialize_repo.sh --inspectto gather source-root candidates, existingdocs/andrule/signals, and overwrite conflicts before materializing files. - After the user answers, rerun the generator with explicit confirmation flags such as
--source-root-dir,--confirm-existing-docs,--confirm-existing-rule, and--overwriteas needed.
- Apply the language policy to output.
- Follow references/language-output.md for the language-selection flow and template-loading behavior.
- Materialize
rule/rules/language-policy.mdand keep generatedAGENTS.md, guide docs, andsubagents_docs/aligned with that authoritative rule. - Read and use only the selected-language templates unless you are explicitly updating the skill itself.
- Keep control filenames, directory names, code, commands, config keys, slugs, and predictable rule-path conventions aligned with the generated language rule.
- Create the rule, subagent, and documentation structure.
- Create
.codex/config.tomland.codex/agents/planner.toml,.codex/agents/generator.toml,.codex/agents/evaluator.tomlas required baseline files. - Set
model_reasoning_effort = "high"for generated planner, generator, and evaluator agents, and keep the surrounding guidance compatible with task-specific adjustment. - Create process-oriented starter local skills under
.codex/skills/change-analysis/,.codex/skills/code-implementation/,.codex/skills/test-debug/,.codex/skills/docs-sync/, and.codex/skills/quality-review/, each with a thinSKILL.mdandagents/openai.yaml. - Write those starter skills with clear task-matching descriptions, aligned metadata, and
policy.allow_implicit_invocation: true. - Keep starter skill bodies thin and rule-referencing. Do not copy stable repository rules into the skill body.
- In existing-project mode, use inspect results to make starter local skill bodies more specific from the observed source root, test/tooling signals, and docs structure without inventing unobserved details.
- Create or update the root
README.mdas the primary human-facing repository summary. - Create or update root
PROJECT_OVERVIEW.mdbefore implementation planning. - In fresh mode, derive
PROJECT_OVERVIEW.mdfrom the initial user requirements and leave explicit placeholders or open questions for missing facts. - In existing-project mode, inspect source root, major modules, existing docs, tests/build tooling, and the current request before writing or refining
PROJECT_OVERVIEW.mdfrom observed facts. - Create or update
subagents_docs/roadmap.mdfromPROJECT_OVERVIEW.md. - The roadmap must split implementation work into phases, define required completion checklists, define verification methods, record dependencies, and block dependent next phases until the previous phase reaches
PASS. - In fresh mode, start
README.mdfrom a minimal template and keep placeholders explicit. - In existing-project mode, inspect the current project and write or refine
README.mdfrom observed purpose, major directories, existing docs, and current entry points without inventing missing details. - In existing-project mode, create focused
docs/guide/documents only when inspection or existing docs reveal stable user-facing workflows that readers actually need. - Good guide targets include execution, deployment, test-running, operations, request intake, or design-request flows that a real reader can follow.
- Do not create guide documents that merely summarize repository layout, runtime areas, tooling signals, test directory listings, project rules, or implementation details.
- Create a thin root
AGENTS.mdthat orchestrates more detailed rules instead of duplicating them. - Start the root file from the language-appropriate template in the skill's
assets/AGENTS/. - Create
rule/index.mdas the authoritative discovery point for detailed rules. - Put detailed rule documents under
rule/rules/. - Start
rule/index.mdfrom the language-appropriate template in the skill'sassets/rule/, then adapt the entries to the repository's actual starter rules underrule/rules/. - Create starter rule documents under
rule/rules/from the language-appropriate templates in the skill'sassets/rule/. - Include a starter rule for rule maintenance and rule-index alignment unless the repository already has a stronger equivalent.
- Include starter rules for root README maintenance and development standards unless the repository already has stronger equivalents.
- Generated
rule/rules/development-standards.mdmust explicitly include required code implementation principles covering existing structure first, reuse over duplication, clear responsibility separation, no hardcoding, fail fast with no silent fallback, YAGNI, explicit naming and behavior, testability, and observability. - Generated development standards must state that implementations conflicting with those principles are incorrect even if the feature appears to work.
- Include a starter rule for unit-test and end-to-end test expectations unless the repository already has a stronger equivalent.
- In fresh mode, make
rule/rules/development-standards.mdprovisional and refine it as real stack, tooling, and structure conventions become concrete during ongoing work. - In existing-project mode, derive
rule/rules/development-standards.mdfrom observed project structure, naming patterns, tooling, automation, and verification commands instead of leaving it generic. - In fresh mode, make
rule/rules/testing-standards.mdprovisional and refine it as real test paths, commands, and frameworks become concrete. - In existing-project mode, derive
rule/rules/testing-standards.mdfrom observed test directories, naming patterns, commands, and tooling instead of leaving it generic. - Include
rule/rules/subagent-orchestration.mdandrule/rules/subagents-docs.mdin the starter rule set unless the repository already has stronger equivalents. - Include
rule/rules/planning-roadmap.mdin the starter rule set unless the repository already has a stronger equivalent. - Create
subagents_docs/AGENTS.mdplus thesubagents_docs/cycles/working area as baseline harness structure. - Default to
docs/guide/README.mdanddocs/implementation/AGENTS.md. - When an implementation record is created, follow the rule-defined section shape directly, including unit-test, end-to-end test, manual-check, and gap notes in
Verification; do not copy skillassets/into the target repository. - Treat implementation records as historical briefings: each new evaluator-passed implementation change creates a new record by default.
- Do not search or update old
docs/implementation/records to synchronize current changes, except for typo fixes, broken links, incorrect verification metadata, or an explicit user request. - Do not create a target-repository
assets/directory unless the user explicitly asked for project assets unrelated to this skill. - Do not pre-create empty implementation category directories during initialization.
- Create other local
AGENTS.mdfiles only where they improve scope clarity. - Keep
rule/authoritative for Codex execution. Treatdocs/guide/anddocs/implementation/as human-facing, not primary rule authority. - Put guidance into the generated
AGENTS.mdfiles stating that implementation categories are concern-based and chosen by Codex from observed repository structure.
- Create
- Apply the required subagent harness.
- Follow references/subagent-orchestration.md for the harness model and role boundaries.
- Materialize
rule/rules/cycle-document-contract.mdand keep generated cycle docs, prompts, and harness-related docs aligned with that authoritative rule. - The main agent owns task classification, plan approval, implementation integration, and handoff decisions.
- The main agent may autonomously invoke subagents when needed, and document analysis should prefer parallel explorer calls when the questions are independent.
- The main agent may wait as long as needed for subagent output, but it must close completed or no-longer-needed subagent threads immediately after their outputs are integrated.
- If stale sessions or thread-limit blockage prevent further delegation, treat thread cleanup as required orchestration work before continuing.
- Small changes should default to
main/generator -> evaluator. - Medium changes should default to
main(plan+implementation) -> evaluator. - Large but clear changes should default to
main-led decomposition + delegated implementation + evaluator. - Large ambiguous changes should default to
parallel explorer analysis + planner assist if needed + main-approved plan + delegated implementation + evaluator. - When evaluator records
FAIL, restart the cycle without asking the user again unless the blocker is truly missing external input. - Re-planning depth should match the task: short-plan revision for medium work, main-led decomposition revision for large clear work, and planner-assisted revision for large ambiguous work.
- Write evaluator rules and prompts around direct validation of the representative user surface for the change: browser UI for web, simulator/runtime for apps, runtime/scene for games, or actual CLI/API entrypoints when those are the primary surfaces.
- If direct user-surface validation is unavailable, require the evaluator to record why, what environment or access is missing, what substitute validation was used, and why an unverified critical surface cannot be soft-passed.
- Do not create or update final
docs/implementation/briefings from a plan-only or generator-only state. - After evaluator
PASS, write a new final briefing for the new implementation result instead of updating old briefings as current-state sync targets. - Keep starter local skills aligned through clear
SKILL.mddescriptions, matching metadata, andallow_implicit_invocationsupport. - Split multiple plans into separate plan cycles; run them in parallel only when they are independent and in order when they are dependent.
- Link each plan cycle to one roadmap phase or phase section.
- When evaluator records
FAIL, update that phase's checklist and notes and continue in the same phase unless an external-input blocker is real. - Start the next dependent phase only after the previous phase's required checklist is satisfied and evaluator records
PASS. - Treat design quality and originality as higher-weight evaluation criteria than completeness and functionality.
- Preserve existing projects carefully.
- Prefer additive initialization.
- Reuse meaningful existing structure where possible.
- Ask before reinterpreting existing directory meaning or folding existing
docs/orrule/trees into the new rule model. - If the inspect pass reports existing
docs/, existingrule/, or generated-file overwrite conflicts, ask the user and continue after the answer instead of treating that state as terminal.
- Derive implementation categories instead of outsourcing the decision.
- Choose
docs/implementation/categories from the repository's observed source areas, architecture boundaries, documentation domains, and recurring work streams when an implementation record is actually being written. - If the repository is new or sparse, do not pre-create placeholder categories. Defer category creation until the first implementation record is needed.
- Avoid weak catch-all category names.
- Configure GitHub workflow policy when the user asked for it.
- Prefer the protection mechanism already in use by the repository.
- Verify the observed remote state after every change.
- Prefer non-destructive checks such as
git push --dry-runwhen validating direct-push behavior.
- Report exact observed state.
- Distinguish between intended policy and observed remote behavior.
- List what was created, what was preserved, what was left untouched, and what is blocked pending clarification.
- If the run pauses for clarification, report the exact questions still pending and resume from those answers instead of restarting the entire workflow.
Required Outputs
Target Repository Outputs
- root
README.md - root
PROJECT_OVERVIEW.md - thin root
AGENTS.md .codex/config.toml.codex/agents/planner.toml.codex/agents/generator.toml.codex/agents/evaluator.toml.codex/skills/change-analysis/SKILL.md.codex/skills/change-analysis/agents/openai.yaml.codex/skills/code-implementation/SKILL.md.codex/skills/code-implementation/agents/openai.yaml.codex/skills/test-debug/SKILL.md.codex/skills/test-debug/agents/openai.yaml.codex/skills/docs-sync/SKILL.md.codex/skills/docs-sync/agents/openai.yaml.codex/skills/quality-review/SKILL.md.codex/skills/quality-review/agents/openai.yamlrule/index.mdwith an explicit Markdown indexrule/rules/with the detailed starter rule documentsrule/rules/subagent-orchestration.mdrule/rules/subagents-docs.mdrule/rules/planning-roadmap.mdrule/rules/cycle-document-contract.mdrule/rules/language-policy.mdsubagents_docs/AGENTS.mdsubagents_docs/roadmap.mdsubagents_docs/cycles/docs/guide/docs/implementation/with category-based record placement rules instead of a flat history directory by defaultdocs/guide/README.mdby default- focused guide documents under
docs/guide/only when actual user-facing workflows justify them docs/implementation/AGENTS.mdby default- starter rule documents including
rule/rules/rule-maintenance.md,rule/rules/readme-maintenance.md,rule/rules/development-standards.md, andrule/rules/testing-standards.md - starter phase-gate rule document
rule/rules/planning-roadmap.md - authoritative cycle and language rules at
rule/rules/cycle-document-contract.mdandrule/rules/language-policy.md - other local
AGENTS.mdfiles where they reduce scope and context - minimal but meaningful starter content in generated files
- no project-local
assets/directory unless explicitly requested by the user
Skill-Bundled Resources
- canonical root README templates at
assets/README/root.en.mdandassets/README/root.ko.md - canonical project overview templates at
assets/PROJECT_OVERVIEW/root.en.mdandassets/PROJECT_OVERVIEW/root.ko.md - canonical root templates at
assets/AGENTS/root.en.mdandassets/AGENTS/root.ko.md - canonical
.codexharness templates atassets/.codex/config.tomlandassets/.codex/agents/*.toml - canonical starter local skill templates at
assets/.codex/skills/change-analysis/,assets/.codex/skills/code-implementation/,assets/.codex/skills/test-debug/,assets/.codex/skills/docs-sync/, andassets/.codex/skills/quality-review/ - canonical starter templates at
assets/rule/index.en.mdandassets/rule/index.ko.md - starter rule templates for the default rule set in
assets/rule/ - canonical planning roadmap rule templates at
assets/rule/planning-roadmap.en.mdandassets/rule/planning-roadmap.ko.md - canonical cycle and language rule templates at
assets/rule/cycle-document-contract.en.md,assets/rule/cycle-document-contract.ko.md,assets/rule/language-policy.en.md, andassets/rule/language-policy.ko.md - canonical
subagents_docs/AGENTS.mdtemplates atassets/subagents_docs/AGENTS.en.mdandassets/subagents_docs/AGENTS.ko.md - canonical roadmap templates at
assets/subagents_docs/roadmap.en.mdandassets/subagents_docs/roadmap.ko.md - canonical implementation-record templates at
assets/docs/implementation/record.en.mdandassets/docs/implementation/record.ko.md - deterministic generator script at
scripts/materialize_repo.sh - release-aware updater script at
scripts/update-skill-release.py
Read references/structure-initialization.md for the detailed structural requirements and ambiguity rules.
Guardrails
- Do not invent application features, stack choices, package files, or category names that are disconnected from observed repository concerns.
- Do not blindly replace a meaningful existing
README.md. - Do not invent
README.mdsections that imply unobserved features, commands, or setup guarantees. - Do not freeze generic development standards as if they were final project-specific rules in a fresh repository.
- Do not write authoritative development standards for an existing repository without analyzing observed structure, tooling, and verification paths first.
- Do not omit the required code implementation principles from generated development standards.
- Do not write authoritative testing standards for an existing repository without analyzing observed test structure, tooling, and verification paths first.
- Do not assume an end-to-end framework exists in a fresh repository before the real stack or delivery surface exists.
- Do not ask the user to name implementation categories unless the user explicitly wants to control category naming.
- Do not flatten
docs/implementation/unless the user explicitly asks for a flat layout. - Do not pre-create empty implementation category directories or placeholder implementation records during initialization.
- Do not create
docs/guide/AGENTS.mdby default whenREADME.mdis sufficient for that directory. - Do not create guide documents from repository structure, runtime classification, tooling inventories, or test layout alone.
- Do not copy project rules or implementation notes into
docs/guide/. - Do not create empty guide documents that merely restate placeholders without a real user workflow.
- Do not leave starter rule placeholders untouched once the real structure becomes known.
- Do not skip baseline development standards when the repository does not yet expose stronger project-specific quality rules.
- Do not copy the skill's
assets/directory into the target repository. - Do not place subagent working documents in
docs/guide/ordocs/implementation/for generated repositories; usesubagents_docs/instead. - Do not use
docs/implementation/for subagent working records in generated repositories; reserve it for final implementation briefings inside concern-based categories after a cycle passes. - Do not treat existing
docs/implementation/briefings as current-state synchronization targets. Current-state sync applies to README, project overview, roadmap, guides, rules, and similar living documents, while new implementation work gets a new briefing record. - Do not create
docs/implementation/briefings/; keepdocs/implementation/category-based. - Do not ask the language question twice after a valid answer or explicit language selection is already available.
- Do not request chooser, submit, modal, or dummy selection UI for the language prompt.
- Do not treat an inspect result that needs user clarification as a terminal failure.
- Do not ask about
docs/orrule/when the existing tree is already compatible with the planned structure and no reinterpretation is needed. - Do not duplicate rules across root and local instruction files.
- Do not start planner/generator/evaluator implementation flow for analysis-only, question-only, review-only, or explanation-only requests.
- Keep starter local skills aligned through clear descriptions, matching metadata, and
allow_implicit_invocationsupport. - Do not leave completed or no-longer-needed subagent threads open after their outputs have been integrated; close them immediately.
- Do not use free-form prose or table-first layouts for the rule index when the standard section-and-fields format is sufficient.
- Do not skip the initial language check: use the already fixed language when present, otherwise ask once in plain text.
- Do not claim branch protection or ruleset enforcement without verifying the remote result.
- Prefer squash-merge workflows when the user wants a clean official history.
- Keep the first pass minimal and safe.
Draft Mode
If the user has not yet provided enough structural decisions, create a clean draft only:
- a skill skeleton
- minimal repository guidance
- clearly labeled placeholders
- a short list of missing decisions
Do not pretend the final workflow is fully specified when it is not.
Example Requests
- "Initialize a new public GitHub repo for a solo maintainer with PR-only main and minimal OSS files."
- "Set up a new Codex CLI project and verify that the default branch cannot be pushed directly."
- "Add Codex rule structure to this existing repo without disturbing the current source tree."
- "Create only a draft of the init workflow for now. I will give the exact repository rules later."