okstra 0.34.0 → 0.36.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (101) hide show
  1. package/README.kr.md +26 -16
  2. package/README.md +26 -16
  3. package/docs/kr/architecture.md +59 -45
  4. package/docs/kr/cli.md +61 -18
  5. package/docs/pr-template-usage.md +65 -0
  6. package/docs/project-structure-overview.md +358 -354
  7. package/docs/superpowers/plans/2026-05-12-ticket-id-in-reports.md +1 -1
  8. package/docs/superpowers/plans/2026-05-14-convergence-queue-pruning.md +1 -1
  9. package/docs/superpowers/plans/2026-05-17-dual-format-final-report.md +1 -1
  10. package/docs/superpowers/plans/2026-05-20-final-report-language.md +1501 -0
  11. package/docs/superpowers/plans/2026-05-20-implementation-planning-multi-stage.md +1267 -0
  12. package/docs/superpowers/plans/2026-05-20-okstra-run-prompt-sot-b1.md +1007 -0
  13. package/docs/superpowers/plans/2026-05-20-wizard-messages-json-sot.md +720 -0
  14. package/docs/superpowers/plans/2026-05-20-wizard-prompt-json-sot-a1.md +681 -0
  15. package/docs/superpowers/plans/2026-05-21-improvement-discovery-task-type.md +1691 -0
  16. package/docs/superpowers/specs/2026-05-20-final-report-language-design.md +383 -0
  17. package/docs/superpowers/specs/2026-05-20-implementation-planning-multi-stage-design.md +320 -0
  18. package/docs/superpowers/specs/2026-05-20-okstra-run-prompt-sot-design.md +299 -0
  19. package/docs/superpowers/specs/2026-05-21-improvement-discovery-task-type-design.md +335 -0
  20. package/docs/task-process/README.md +74 -0
  21. package/docs/task-process/common-flow.md +166 -0
  22. package/docs/task-process/error-analysis.md +101 -0
  23. package/docs/task-process/final-verification.md +167 -0
  24. package/docs/task-process/implementation-planning.md +128 -0
  25. package/docs/task-process/implementation.md +149 -0
  26. package/docs/task-process/release-handoff.md +206 -0
  27. package/docs/task-process/requirements-discovery.md +115 -0
  28. package/package.json +1 -1
  29. package/runtime/BUILD.json +2 -2
  30. package/runtime/agents/SKILL.md +29 -13
  31. package/runtime/agents/workers/claude-worker.md +26 -0
  32. package/runtime/agents/workers/codex-worker.md +27 -1
  33. package/runtime/agents/workers/gemini-worker.md +27 -1
  34. package/runtime/agents/workers/report-writer-worker.md +8 -1
  35. package/runtime/bin/okstra-central.sh +6 -6
  36. package/runtime/bin/okstra-codex-exec.sh +49 -28
  37. package/runtime/bin/okstra-gemini-exec.sh +39 -21
  38. package/runtime/bin/okstra-render-final-report.py +13 -2
  39. package/runtime/bin/okstra-wrapper-status.py +155 -0
  40. package/runtime/bin/okstra.sh +2 -2
  41. package/runtime/prompts/profiles/_common-contract.md +11 -6
  42. package/runtime/prompts/profiles/error-analysis.md +3 -7
  43. package/runtime/prompts/profiles/implementation-planning.md +22 -21
  44. package/runtime/prompts/profiles/implementation.md +28 -11
  45. package/runtime/prompts/profiles/improvement-discovery.md +42 -0
  46. package/runtime/prompts/profiles/kr/_common-contract.md +92 -0
  47. package/runtime/prompts/profiles/kr/error-analysis.md +36 -0
  48. package/runtime/prompts/profiles/kr/final-verification.md +48 -0
  49. package/runtime/prompts/profiles/kr/implementation-planning.md +90 -0
  50. package/runtime/prompts/profiles/kr/implementation.md +144 -0
  51. package/runtime/prompts/profiles/kr/improvement-discovery.md +42 -0
  52. package/runtime/prompts/profiles/kr/release-handoff.md +104 -0
  53. package/runtime/prompts/profiles/kr/requirements-discovery.md +42 -0
  54. package/runtime/prompts/profiles/release-handoff.md +1 -1
  55. package/runtime/prompts/profiles/requirements-discovery.md +8 -12
  56. package/runtime/prompts/wizard/prompts.ko.json +230 -0
  57. package/runtime/python/lib/okstra/cli.sh +2 -49
  58. package/runtime/python/lib/okstra/globals.sh +21 -21
  59. package/runtime/python/lib/okstra/interactive.sh +7 -7
  60. package/runtime/python/okstra_ctl/clarification_items.py +3 -9
  61. package/runtime/python/okstra_ctl/consumers.py +53 -0
  62. package/runtime/python/okstra_ctl/final_report_schema.py +0 -7
  63. package/runtime/python/okstra_ctl/i18n.py +73 -0
  64. package/runtime/python/okstra_ctl/improvement_lenses.py +44 -0
  65. package/runtime/python/okstra_ctl/index.py +1 -1
  66. package/runtime/python/okstra_ctl/paths.py +23 -20
  67. package/runtime/python/okstra_ctl/render.py +147 -202
  68. package/runtime/python/okstra_ctl/render_final_report.py +53 -10
  69. package/runtime/python/okstra_ctl/run.py +292 -107
  70. package/runtime/python/okstra_ctl/run_context.py +22 -0
  71. package/runtime/python/okstra_ctl/seeding.py +186 -0
  72. package/runtime/python/okstra_ctl/wizard.py +348 -127
  73. package/runtime/python/okstra_ctl/workflow.py +21 -2
  74. package/runtime/python/okstra_ctl/worktree.py +54 -1
  75. package/runtime/python/okstra_project/resolver.py +4 -3
  76. package/runtime/python/okstra_token_usage/report.py +2 -2
  77. package/runtime/schemas/final-report-v1.0.schema.json +22 -16
  78. package/runtime/skills/okstra-brief/SKILL.md +124 -31
  79. package/runtime/skills/okstra-convergence/SKILL.md +2 -3
  80. package/runtime/skills/okstra-report-writer/SKILL.md +35 -15
  81. package/runtime/skills/okstra-run/SKILL.md +5 -4
  82. package/runtime/skills/okstra-schedule/SKILL.md +4 -4
  83. package/runtime/skills/okstra-setup/SKILL.md +27 -0
  84. package/runtime/skills/okstra-team-contract/SKILL.md +1 -1
  85. package/runtime/templates/okstra.CLAUDE.md +104 -0
  86. package/runtime/templates/reports/final-report.template.md +93 -98
  87. package/runtime/templates/reports/i18n/en.json +135 -0
  88. package/runtime/templates/reports/i18n/ko.json +135 -0
  89. package/runtime/templates/reports/implementation-planning-input.template.md +18 -0
  90. package/runtime/templates/reports/improvement-discovery-input.template.md +78 -0
  91. package/runtime/templates/reports/task-brief.template.md +2 -2
  92. package/runtime/validators/lib/fixtures.sh +30 -0
  93. package/runtime/validators/lib/runners.sh +1 -1
  94. package/runtime/validators/validate-implementation-plan-stages.py +211 -0
  95. package/runtime/validators/validate-run.py +121 -26
  96. package/runtime/validators/validate-workflow.sh +2 -2
  97. package/runtime/validators/validate_improvement_report.py +275 -0
  98. package/src/config.mjs +18 -0
  99. package/src/install.mjs +41 -14
  100. package/src/setup.mjs +133 -1
  101. package/src/uninstall.mjs +21 -1
@@ -1,444 +1,448 @@
1
1
  # Okstra — 폴더 구조 및 기능 요약
2
2
 
3
- > 문서는 PRD 작성을 위한 선행 분석 자료다. Okstra 프로젝트 전체의 폴더 구조, 주요 스킬, Python/Node.js 클래스·함수의 용도를 한눈에 정리한다.
3
+ > 현재 저장소 기준의 living map입니다. 빠른 사용법은 [`README.kr.md`](../README.kr.md), 내부 실행 계약은 [`docs/kr/architecture.md`](kr/architecture.md), CLI 세부 옵션은 [`docs/kr/cli.md`](kr/cli.md)를 함께 보세요.
4
4
 
5
5
  ---
6
6
 
7
7
  ## 목차
8
8
 
9
9
  - [1. 프로젝트 정체성](#1-프로젝트-정체성)
10
- - [2. 최상위 폴더 트리 (depth 2-3)](#2-최상위-폴더-트리-depth-2-3)
11
- - [3. 폴더별 역할 주요 파일](#3-폴더별-역할-및-주요-파일)
12
- - [3.1 `src/` — Node.js CLI 진입점 & 설치/진단](#31-src--nodejs-cli-진입점--설치진단)
13
- - [3.2 `scripts/` — Python + Bash 런타임 소스](#32-scripts--python--bash-런타임-소스)
14
- - [3.2.1 `okstra_ctl/` 오케스트레이션 핵심](#321-scriptsokstra_ctl--오케스트레이션-핵심-python-약-30-모듈)
15
- - [3.2.2 `okstra_project/` — 프로젝트 메타 리졸버](#322-scriptsokstra_project--프로젝트-메타-리졸버)
16
- - [3.2.3 `okstra_token_usage/` 토큰 & 비용 추적](#323-scriptsokstra_token_usage--토큰--비용-추적)
17
- - [3.2.4 `lib/okstra/` Bash 헬퍼](#324-scriptslibokstra--bash-헬퍼)
18
- - [3.2.5 `lib/okstra-ctl/` — Bash CLI 라우팅](#325-scriptslibokstra-ctl--bash-cli-라우팅)
19
- - [3.2.6 기타 최상위 스크립트](#326-기타-최상위-스크립트)
20
- - [3.3 `prompts/` — Phase별 프롬프트 템플릿](#33-prompts--phase별-프롬프트-템플릿)
21
- - [3.4 `templates/` — Render 산출물 템플릿](#34-templates--render-산출물-템플릿)
22
- - [3.5 `validators/` — Workflow / Schedule 검증](#35-validators--workflow--schedule-검증)
23
- - [3.6 `agents/` — Lead 정의 & Worker 정의](#36-agents--lead-정의--worker-정의)
24
- - [3.7 `skills/` — 12개 Claude Code 슬래시 커맨드](#37-skills--12개-claude-code-슬래시-커맨드)
25
- - [3.8 `bin/okstra` — Node.js CLI](#38-binokstra--nodejs-cli)
26
- - [3.9 `tools/build.mjs` — 빌드 시스템](#39-toolsbuildmjs--빌드-시스템)
27
- - [3.10 `tests/`, `tests-e2e/` — 검증](#310-tests-tests-e2e--검증)
28
- - [3.11 `docs/` — 문서](#311-docs--문서)
29
- - [4. Python 주요 모듈 · 클래스 요약](#4-python-주요-모듈--클래스-요약)
30
- - [5. Node.js 주요 모듈 요약](#5-nodejs-주요-모듈-요약)
31
- - [6. 런타임 저장소 구조 (설치 후)](#6-런타임-저장소-구조-설치-후)
32
- - [7. 주요 워크플로우](#7-주요-워크플로우)
33
- - [7.1 새 Task 시작 (`/okstra-run`)](#71-새-task-시작-okstra-run)
34
- - [7.2 Phase Routing](#72-phase-routing)
35
- - [7.3 Worker 검증 (Phase 4-5)](#73-worker-검증-phase-4-5)
36
- - [7.4 최종 보고서 (Phase 6-7)](#74-최종-보고서-phase-6-7)
37
- - [8. PRD 작성을 위한 다음 단계](#8-prd-작성을-위한-다음-단계)
10
+ - [2. 최상위 구조](#2-최상위-구조)
11
+ - [3. Build / install 경계](#3-build--install-경계)
12
+ - [4. 폴더별 역할](#4-폴더별-역할)
13
+ - [5. 주요 런타임 모듈](#5-주요-런타임-모듈)
14
+ - [6. 설치 저장소 구조](#6-설치-후-저장소-구조)
15
+ - [7. 핵심 워크플로우](#7-핵심-워크플로우)
16
+ - [8. 문서 유지보수 체크리스트](#8-문서-유지보수-체크리스트)
17
+ - [부록 A. Report / row ID 용어](#부록-a-report--row-id-용어)
38
18
 
39
19
  ---
40
20
 
41
21
  ## 1. 프로젝트 정체성
42
22
 
43
- **Okstra** (v0.20.1)는 **Claude Code 기반 다중 에이전트 크로스 검증 오케스트레이터 런타임**이다.
23
+ `okstra`는 npm package `okstra`로 배포되는 Claude Code multi-agent cross-verification runtime입니다. 단발성 reviewer가 아니라 stable task key를 중심으로 lead + worker 모델을 여러 lifecycle phase에 걸쳐 운영합니다.
44
24
 
45
- - **모델**: Lead(사용자) + Worker(Claude / Codex / Gemini) 분업 구조
46
- - **핵심 원칙**:
47
- 1. 단일 진입점 — `prepare_task_bundle()` (CLI / Skill 양쪽이 동일 함수 호출)
48
- 2. 지속적 작업 정체성 — `<project-id>/<task-group>/<task-id>` 키가 모든 phase·session·모델 업그레이드 동안 불변
49
- 3. 의무적 Lead/Worker 계약 — phase별 허용/금지 산출·행동 규칙
50
- - **배포 형태**: npm 패키지 `okstra` → 설치 시 `~/.okstra` 런타임 + `~/.claude/skills/` 내 12개 슬래시 커맨드 + 4종 worker 에이전트 자동 등록
51
- - **Phase 흐름**: requirements-discovery → error-analysis → implementation-planning → implementation → final-verification → release-handoff
25
+ 현재 기준:
52
26
 
53
- ---
54
-
55
- ## 2. 최상위 폴더 트리 (depth 2-3)
56
-
57
- ```
58
- okstra/
59
- ├── bin/okstra Node.js CLI 진입점 (12 sub-command 라우터)
60
- ├── src/ 설치·진단·경로 해석 (Node.js ES 모듈)
61
- ├── scripts/ Python + Bash 런타임 소스
62
- │ ├── okstra.sh 주 CLI 래퍼
63
- │ ├── okstra_ctl/ 순수 오케스트레이션 로직 (Python)
64
- │ ├── okstra_project/ 프로젝트 메타 리졸버
65
- │ ├── okstra_token_usage/ 토큰 / 비용 계산기
66
- │ ├── lib/okstra/ bash 헬퍼 라이브러리
67
- │ └── lib/okstra-ctl/ bash 서브커맨드 라우팅
68
- ├── prompts/ Phase별 프롬프트 + 6개 task-type 프로필
69
- ├── templates/ Render 산출물 템플릿 (reports, prd, project-docs)
70
- ├── validators/ Workflow / Schedule / Run 검증 스크립트
71
- ├── agents/ Lead SKILL.md + 4종 worker 정의
72
- ├── skills/ 12개 Claude Code 슬래시 커맨드 (markdown)
73
- ├── runtime/ build 산출물 (gitignored, install 대상)
74
- ├── tools/build.mjs runtime/ 동기화 빌드 스크립트
75
- ├── tests/ pytest 단위 테스트 36개
76
- ├── tests-e2e/ bash E2E 시나리오 4개
77
- ├── docs/ 한글 아키텍처 + 설계 문서
78
- ├── package.json npm 메타 (v0.20.1)
79
- ├── README.md / README.kr.md 영문 / 한글 사용 설명서
80
- └── CHANGELOG.md / CHANGES.md 변경 이력
81
- ```
82
-
83
- ---
84
-
85
- ## 3. 폴더별 역할 및 주요 파일
86
-
87
- ### 3.1 `src/` — Node.js CLI 진입점 & 설치/진단
88
-
89
- 각 모듈은 `run(args: string[]) → Promise<number>` 시그니처를 따른다. `bin/okstra`가 명령별로 동적 로드한다.
27
+ - package version: `0.34.1`
28
+ - Node CLI entrypoint: `bin/okstra`
29
+ - Python orchestration authority: `scripts/okstra_ctl/run.py::prepare_task_bundle`
30
+ - lifecycle: `requirements-discovery → error-analysis → implementation-planning → implementation → final-verification → release-handoff`
31
+ - installed skills: 13개
32
+ - worker agents: `claude`, `codex`, `gemini`, `report-writer`
33
+ - final report SSOT: `schemas/final-report-v1.0.schema.json` + `*.data.json`
90
34
 
91
- | 파일 | 용도 |
92
- |------|------|
93
- | `version.mjs` | 패키지 버전 조회 |
94
- | `install.mjs` | `~/.okstra` 자동 프로비저닝, 스킬 MD 등록 |
95
- | `doctor.mjs` | 런타임 상태 진단 (설치, Python import, 권한) |
96
- | `paths.mjs` | 런타임 경로 JSON/Shell 출력 (`OKSTRA_*` 환경 변수) |
97
- | `setup.mjs` | 프로젝트별 `.project-docs/okstra/project.json` 생성 |
98
- | `check-project.mjs` | 현재 디렉토리가 okstra 프로젝트인지 검증 |
99
- | `task-list.mjs` | 프로젝트 내 task 목록 JSON 반환 |
100
- | `task-show.mjs` | 특정 task의 manifest + workflow phase 상태 |
101
- | `worktree-lookup.mjs` | 작업별 git worktree 경로 조회 |
102
- | `plan-validate.mjs` | Approved plan 파일의 approval marker 검증 |
103
- | `render-bundle.mjs` | `prepare_task_bundle()` 산출 미리보기 |
104
- | `wizard.mjs` | okstra-run 인터랙티브 입력 상태머신 구동 (`init`/`step`/`render-args`/`confirmation`) |
105
- | `uninstall.mjs` | `~/.okstra` 및 스킬 제거 |
35
+ 설계 원칙:
106
36
 
107
- **핵심 설계**: 모든 CLI 명령은 `okstra paths --shell` 결과를 환경변수로 로드한 뒤, Python의 단일 진입점 `okstra_ctl.run.prepare_task_bundle`을 호출한다. CLI(`okstra.sh`) skill(`okstra-run`)이 같은 Python 함수를 공유하는 **Rule of Two**를 강제한다.
37
+ 1. **Single prepare authority**: slash skill, Bash CLI, Node preview 모두 `prepare_task_bundle()`로 수렴합니다.
38
+ 2. **Stable task identity**: `<project-id>/<task-group>/<task-id>`가 phase, run, worktree, report를 관통합니다.
39
+ 3. **Artifact-home rule**: okstra-owned project artifact root는 `<PROJECT_ROOT>/.project-docs/okstra/**` 하나입니다.
40
+ 4. **Template/schema/validator lockstep**: `templates/`, `schemas/`, `validators/`, worker/report-writer 계약이 같은 report shape를 강제합니다.
108
41
 
109
42
  ---
110
43
 
111
- ### 3.2 `scripts/` — Python + Bash 런타임 소스
112
-
113
- #### 3.2.1 `scripts/okstra_ctl/` — 오케스트레이션 핵심 (Python, 약 30 모듈)
114
-
115
- | 모듈 | 주요 클래스 / 함수 |
116
- |------|-------------------|
117
- | `run.py` | `prepare_task_bundle(PrepareInputs) → PrepareOutputs` — 단일 권위 진입점 |
118
- | `render.py` | `_render_*()` — 9개 산출물 (manifest, settings, discovery, brief, input, prompt, team-state, workflow, brief-input) |
119
- | `workflow.py` | Phase sequence + 허용/금지 산출·행동 규칙 |
120
- | `paths.py` | `compute_run_paths()` — Run 디렉토리 트리 계산 |
121
- | `ids.py` | Run ID 조합/파싱, task segment slugify |
122
- | `index.py` | `~/.okstra/recent.jsonl`, `active.jsonl` 기록 |
123
- | `reconcile.py` | Active run 상태 수집 / 정규화 (타임아웃 처리) |
124
- | `listing.py` | Task/run 테이블 포맷팅 |
125
- | `resolver.py` | Run ID → file path 해석 |
126
- | `worktree.py` | Git worktree 자동 프로비저닝 및 레지스트리 |
127
- | `workers.py` | Worker 모델 할당 (Claude/Codex/Gemini) |
128
- | `backfill.py` | 레거시 run 자동 마이그레이션 |
129
- | `models.py` | `ModelAssignment`, `PrepareInputs`, `PrepareOutputs` 데이터클래스 |
130
- | `wizard.py` | `WizardState`, `Prompt`, `STEPS` — okstra-run 입력 수집 상태머신 (단일 권위) |
131
-
132
- #### 3.2.2 `scripts/okstra_project/` — 프로젝트 메타 리졸버
133
-
134
- | 모듈 | 역할 |
135
- |------|------|
136
- | `resolver.py` | CWD에서 프로젝트 루트 및 `project.json` 찾기 |
137
- | `state.py` | Project metadata 읽기 / 쓰기 |
138
-
139
- #### 3.2.3 `scripts/okstra_token_usage/` — 토큰 & 비용 추적
140
-
141
- | 모듈 | 역할 |
142
- |------|------|
143
- | `collect.py` | Claude/Codex/Gemini 세션 집계 |
144
- | `pricing.py` | 모델별 가격 계산 (USD) |
145
- | `report.py` | 최종 보고서에 토큰 블록 삽입 |
146
- | `claude.py`, `codex.py`, `gemini.py` | 각 모델 세션 조회 어댑터 |
147
-
148
- #### 3.2.4 `scripts/lib/okstra/` — Bash 헬퍼
149
-
150
- | 파일 | 용도 |
151
- |------|------|
152
- | `globals.sh` | 환경 변수, 경로, 기본값 |
153
- | `cli.sh` | `--task-type`, `--executor`, `--approve`, `--base-ref` 파싱 |
154
- | `interactive.sh` | 사용자 입력 수집 (project root, task, model) |
155
- | `project-resolver.sh` | CWD 기반 프로젝트 루트 찾기 (Bash 버전) |
156
- | `usage.sh` | `okstra.sh --help` 텍스트 |
157
-
158
- #### 3.2.5 `scripts/lib/okstra-ctl/` — Bash CLI 라우팅
159
-
160
- `cmd-batch.sh`, `cmd-list.sh`, `cmd-rerun.sh`, `cmd-tail.sh`, `cmd-show.sh`, `cmd-open.sh`, `cmd-reconcile.sh`, `cmd-projects.sh`, `cmd-reindex.sh` 등 12개 서브커맨드.
161
-
162
- #### 3.2.6 기타 최상위 스크립트
163
-
164
- | 파일 | 용도 |
165
- |------|------|
166
- | `okstra.sh` | 주 CLI 진입점 |
167
- | `okstra-central.sh` | `record_start` 중앙 lock 관리 |
168
- | `okstra-codex-exec.sh` | Codex worker executor (live log mirror, tmux trace pane) |
169
- | `okstra-gemini-exec.sh` | Gemini worker executor |
170
- | `okstra-trace-cleanup.sh` | Claude `/exit` 시 trace pane registry 청소 (`SessionEnd` 훅에서 호출) |
171
- | `okstra-error-log.py` | Worker 오류 패턴 분석 |
172
- | `okstra-spawn-followups.py` | Phase 완료 후 다음 phase dispatch |
173
- | `okstra-token-usage.py` | Token collection CLI 엔트리 |
44
+ ## 2. 최상위 구조
174
45
 
175
- ---
176
-
177
- ### 3.3 `prompts/` — Phase별 프롬프트 템플릿
178
-
179
- | 파일 | 용도 |
180
- |------|------|
181
- | `launch.template.md` | Lead 시작 프롬프트 (task brief, worker 할당, 규칙 로드) |
182
- | `profiles/_common-contract.md` | 모든 phase 공통 Lead/Worker 계약 |
183
- | `profiles/requirements-discovery.md` | Phase 1: 작업 분류 & 라우팅 |
184
- | `profiles/error-analysis.md` | Phase 2: 증상 재현 & 근본 원인 |
185
- | `profiles/implementation-planning.md` | Phase 3: 옵션 검토 & 승인 대기 |
186
- | `profiles/implementation.md` | Phase 4: 코드 편집 & Worker 검증 |
187
- | `profiles/final-verification.md` | Phase 5: 최종 verdict |
188
- | `profiles/release-handoff.md` | Phase 6: Commit/PR/Deploy |
189
-
190
- ---
191
-
192
- ### 3.4 `templates/` Render 산출물 템플릿
46
+ ```text
47
+ okstra/
48
+ ├── bin/okstra Node CLI router
49
+ ├── src/ Node command modules
50
+ ├── scripts/ Python + Bash runtime sources
51
+ │ ├── okstra_ctl/ orchestration core
52
+ │ ├── okstra_project/ project root / project.json resolver
53
+ │ ├── okstra_token_usage/ token usage + cost accounting
54
+ │ ├── okstra_vendor/ vendored Jinja2 / MarkupSafe
55
+ │ ├── lib/okstra/ Bash helpers for okstra.sh
56
+ │ └── lib/okstra-ctl/ Bash control-center subcommands
57
+ ├── skills/ Claude Code skills (13)
58
+ ├── agents/ lead SKILL.md + worker agent specs
59
+ ├── prompts/ launch template, phase profiles, wizard prompt JSON
60
+ ├── schemas/ JSON schema for final-report data.json
61
+ ├── templates/ report, setup, PR, project-doc templates/assets
62
+ ├── validators/ run / brief / schedule / view validators
63
+ ├── tools/build.mjs source runtime sync
64
+ ├── runtime/ generated install payload; do not edit directly
65
+ ├── tests/ pytest unit suite
66
+ ├── tests-e2e/ Bash end-to-end scenarios
67
+ ├── docs/ architecture, CLI, plans/specs
68
+ ├── package.json npm metadata and published file list
69
+ ├── README.md / README.kr.md user manuals
70
+ ├── CHANGES.md / CHANGELOG.md human-authored and generated changelogs
71
+ └── RELEASING.md release process
72
+ ```
193
73
 
194
- - `templates/reports/` task-brief, quick-input, implementation-planning-input, implementation-input, error-analysis-input, final-verification-input, release-handoff-input, final-report, schedule, settings.template.json
195
- - `templates/prd/` — PRD 스타일 brief
196
- - `templates/project-docs/` — Project-level task 카탈로그(task-index)
74
+ `runtime/` is build output. Source edits go to `scripts/`, `skills/`, `agents/`, `prompts/`, `schemas/`, `templates/`, `validators/`; then `npm run build` syncs them into `runtime/`.
197
75
 
198
76
  ---
199
77
 
200
- ### 3.5 `validators/` — Workflow / Schedule 검증
78
+ ## 3. Build / install 경계
201
79
 
202
- | 파일 | 용도 |
203
- |------|------|
204
- | `validate-run.py` | Single run 검증 (manifest 스키마, 산출물 존재, phase 규칙) |
205
- | `validate-schedule.py` | Task Group schedule 가능성 (의존성, 시간 추정) |
206
- | `validate-workflow.sh` | Phase rule 적용 (forbidden actions 감지) |
207
- | `lib/validate-*.sh` | 공용 검증 함수 (assets, prompt metadata, tasks) |
80
+ ### 3.1 npm package
208
81
 
209
- ---
82
+ `package.json` publishes:
210
83
 
211
- ### 3.6 `agents/` — Lead 정의 & Worker 정의
84
+ - `bin/`
85
+ - `src/`
86
+ - `runtime/`
87
+ - `docs/`
88
+ - `README.md`
89
+ - `README.kr.md`
212
90
 
213
- | 파일 | 역할 |
214
- |------|------|
215
- | `SKILL.md` (28KB) | **okstra-lead** 에이전트 정의 (Phase 라우팅, Worker roster 검증) |
216
- | `workers/claude-worker.md` | Claude read-only analyzer (phase 2-5 기본) |
217
- | `workers/codex-worker.md` | Codex executor (implementation phase) |
218
- | `workers/gemini-worker.md` | Gemini verifier (선택) |
219
- | `workers/report-writer-worker.md` | Final report 작성 (phase 6) |
91
+ So `runtime/` is not the only npm-published content. It is the install payload copied into `~/.okstra`.
220
92
 
221
- ---
93
+ ### 3.2 Build sync
222
94
 
223
- ### 3.7 `skills/` — 13개 Claude Code 슬래시 커맨드
224
-
225
- | ID | 이름 | 공개 | 용도 |
226
- |----|------|------|------|
227
- | 1 | okstra-run | YES | 새 task 시작 또는 다음 phase 진행 |
228
- | 2 | okstra-status | YES | 현재 phase / blocker / workStatus 조회·갱신 |
229
- | 3 | okstra-history | YES | 과거 실행 목록 + 재실행 |
230
- | 4 | okstra-schedule | YES | Task Group 작업 일정 생성 |
231
- | 5 | okstra-setup | YES | 프로젝트 첫 등록 (`project.json` 생성) |
232
- | 6 | okstra-context-loader | NO | Task bundle 경로 / manifest 로드 (자동) |
233
- | 7 | okstra-team-contract | NO | Lead/Worker 규칙 검증 (자동) |
234
- | 8 | okstra-convergence | NO | Phase 5.5 consensus 수집 |
235
- | 9 | okstra-report-writer | NO | Phase 6-7 최종 보고서 작성 |
236
- | 10 | okstra-report-finder | NO | 보고서 검색 (자동 트리거) |
237
- | 11 | okstra-time-summary | NO | 소요 시간 분석 |
238
- | 12 | okstra-logs | YES | 로그 인벤토리·정리 (worker wrapper `*.log` sidecars 조회 및 cleanup 제안) |
239
- | 13 | okstra-brief | YES | 요구사항 문서·티켓·링크·대화로부터 `okstra-run` 입력용 task brief 마크다운 생성 |
240
-
241
- 각 skill 구조: **Step 0 런타임 검증 → Step 1-N 작업 수행 → 실패 시 사용자 안내**.
95
+ `tools/build.mjs` rebuilds `runtime/` from:
242
96
 
243
- ---
97
+ | Source | Runtime destination |
98
+ |---|---|
99
+ | `scripts/okstra_project` | `runtime/python/okstra_project` |
100
+ | `scripts/okstra_ctl` | `runtime/python/okstra_ctl` |
101
+ | `scripts/okstra_token_usage` | `runtime/python/okstra_token_usage` |
102
+ | `scripts/okstra_vendor` | `runtime/python/okstra_vendor` |
103
+ | `scripts/lib` | `runtime/python/lib` |
104
+ | selected `scripts/okstra*.sh` / `*.py` entrypoints | `runtime/bin/` |
105
+ | `agents`, `prompts`, `schemas`, `templates`, `validators`, `skills` | same relative tree under `runtime/` |
244
106
 
245
- ### 3.8 `bin/okstra` Node.js CLI
107
+ `npm run build` and `prepack` both run this sync. Never hand-edit `runtime/`.
246
108
 
247
- 13개 명령(`paths`, `install`, `ensure-installed`, `uninstall`, `doctor`, `setup`, `check-project`, `task-list`, `task-show`, `worktree-lookup`, `plan-validate`, `render-bundle`, `wizard`) 라우터. 명령 파싱 → `src/<cmd>.mjs` 동적 로드 → `run(args)` 호출 → exit code 반환.
109
+ ### 3.3 Install output
248
110
 
249
- ---
111
+ `okstra install` copies or symlinks:
250
112
 
251
- ### 3.9 `tools/build.mjs` 빌드 시스템
113
+ - `runtime/python/*` `~/.okstra/lib/python/`
114
+ - `runtime/bin/*` → `~/.okstra/bin/`
115
+ - `runtime/templates/*` → `~/.okstra/templates/`
116
+ - `runtime/skills/<name>` → `~/.claude/skills/<name>`
117
+ - `runtime/agents/workers/*.md` → `~/.claude/agents/*-worker.md`
118
+ - install manifests → `~/.okstra/installed-skills.json`, `~/.okstra/installed-agents.json`
119
+ - version stamp → `~/.okstra/version`
252
120
 
253
- `runtime/` 디렉토리를 `scripts/`, `skills/`, `agents/`, `prompts/`, `templates/`, `validators/`에서 동기화. `prepack` hook으로 npm publish 시 자동 실행.
121
+ `--link <repo>` mode is for development and symlinks installed files back to repo sources.
254
122
 
255
123
  ---
256
124
 
257
- ### 3.10 `tests/`, `tests-e2e/` — 검증
258
-
259
- | 종류 | 파일 | 용도 |
260
- |------|--------|------|
261
- | pytest 단위 | 36개 | `okstra_ctl.*` 모듈 단위 검증 |
262
- | bash E2E | 4개 | record_start / rerun / lock / agent install |
125
+ ## 4. 폴더별 역할
126
+
127
+ ### 4.1 `bin/` and `src/` Node CLI
128
+
129
+ `bin/okstra` is a thin dynamic-import router. Every command module exports `run(args) -> Promise<number>` or a named install/uninstall runner.
130
+
131
+ | Command | Module | Role |
132
+ |---|---|---|
133
+ | `paths` | `src/paths.mjs` | Resolve package/runtime/home paths |
134
+ | `install`, `ensure-installed` | `src/install.mjs` | Install or refresh runtime, skills, agents, templates |
135
+ | `uninstall` | `src/uninstall.mjs` | Remove managed runtime/skills/agents, optionally purge data |
136
+ | `doctor` | `src/doctor.mjs` | Diagnose runtime and Python imports |
137
+ | `setup` | `src/setup.mjs` | Create/update `<PROJECT_ROOT>/.project-docs/okstra/project.json` |
138
+ | `check-project` | `src/check-project.mjs` | Verify project registration |
139
+ | `config` | `src/config.mjs` | Read/write project/global settings such as PR template path |
140
+ | `task-list`, `task-show` | `src/task-list.mjs`, `src/task-show.mjs` | Task/run introspection for skills |
141
+ | `worktree-lookup` | `src/worktree-lookup.mjs` | Look up a task-key's registered worktree |
142
+ | `plan-validate` | `src/plan-validate.mjs` | Check approved-plan approval marker |
143
+ | `render-bundle` | `src/render-bundle.mjs` | Preview `prepare_task_bundle(render_only=True)` |
144
+ | `render-views` | `src/render-views.mjs` | Generate slim MD + self-contained HTML report views |
145
+ | `wizard` | `src/wizard.mjs` | Drive the `okstra-run` interactive state machine |
146
+ | `token-usage` | `src/token-usage.mjs` | Wrap installed Python token usage CLI |
147
+
148
+ `src/_python-helper.mjs` centralizes Node → Python execution so command modules do not duplicate subprocess wiring.
149
+
150
+ ### 4.2 `scripts/` — Runtime source
151
+
152
+ Top-level scripts:
153
+
154
+ | File | Role |
155
+ |---|---|
156
+ | `okstra.sh` | Bash CLI wrapper around `prepare_task_bundle`, optionally launches `claude` |
157
+ | `okstra-ctl.sh` | Bash control center for list/show/open/rerun/reconcile/project commands |
158
+ | `okstra-central.sh` | Central run index writer / reconciler entrypoint |
159
+ | `okstra-codex-exec.sh`, `okstra-gemini-exec.sh` | Worker CLI wrappers with log/status sidecars |
160
+ | `okstra-wrapper-status.py` | Heartbeat sidecar writer used by worker wrappers |
161
+ | `okstra-token-usage.py` | Token usage CLI entrypoint |
162
+ | `okstra-render-final-report.py` | Render final-report Markdown from data.json |
163
+ | `okstra-render-report-views.py` | Render slim MD + HTML views from final-report Markdown |
164
+ | `okstra-error-log.py` | Normalize worker/lead error sidecars |
165
+ | `okstra-spawn-followups.py` | Follow-up spawning helper |
166
+ | `okstra-trace-cleanup.sh` | tmux trace pane cleanup |
167
+
168
+ ### 4.3 `scripts/okstra_ctl/` — Python orchestration core
169
+
170
+ Important modules:
171
+
172
+ | Module | Role |
173
+ |---|---|
174
+ | `run.py` | `prepare_task_bundle()` single authority and CLI parser |
175
+ | `run_context.py` | Per-task mutex, run context and run-input persistence; `consumers_mutex` helper for atomic `consumers.jsonl` writes |
176
+ | `consumers.py` | Append-only `consumers.jsonl` writer + reader — records which `implementation` runs consumed which `implementation-planning` stage |
177
+ | `paths.py` | Path/sequence computation for task/run artifacts |
178
+ | `render.py` | task manifest, run manifest, timeline, task index, discovery, team-state, prompt/template render |
179
+ | `workflow.py` | Phase sequence, allowed outputs, forbidden actions, next phase |
180
+ | `workers.py`, `models.py` | Worker roster and model metadata resolution |
181
+ | `worktree.py`, `worktree_registry.py` | One worktree per task-key, branch registry, sync dirs/files/snapshots |
182
+ | `project_meta.py`, `resolver.py`, `path_resolve.py` | Project/task/run resolution |
183
+ | `clarification_items.py` | Unified §5 clarification table parser and approval blockers |
184
+ | `qa_commands.py` | QA command deny-list validation for plans |
185
+ | `pr_template.py` | PR body template resolution for release-handoff |
186
+ | `report_views.py`, `render_final_report.py`, `final_report_schema.py` | Final-report data.json → Markdown → slim/HTML pipeline |
187
+ | `wizard.py` | `okstra-run` prompt state machine; user-facing Korean strings live in `prompts/wizard/prompts.ko.json` |
188
+ | `index.py`, `jsonl.py`, `reconcile.py`, `listing.py`, `batch.py`, `backfill.py` | `~/.okstra` run index and history operations |
189
+ | `session.py`, `tmux.py`, `seeding.py`, `locks.py`, `invocation.py`, `sequence.py`, `ids.py`, `material.py` | Supporting lifecycle helpers |
190
+ | `improvement_lenses.py` | improvement-discovery phase 의 lens enum SSOT + cap 상수 (DEFAULT 8, ABSOLUTE 12, MIN/MAX PRIORITY 1/4, SOURCE_WORKERS) |
191
+
192
+ ### 4.4 `scripts/okstra_project/`
193
+
194
+ Project resolver and read-only state helpers:
195
+
196
+ - `resolver.py`: locate project root and upsert `project.json`
197
+ - `state.py`: read project metadata, task catalog, task manifest
198
+
199
+ ### 4.5 `scripts/okstra_token_usage/`
200
+
201
+ Token/cost accounting:
202
+
203
+ - provider adapters: `claude.py`, `codex.py`, `gemini.py`
204
+ - aggregation: `collect.py`, `blocks.py`, `jsonl_io.py`, `paths.py`
205
+ - pricing: `pricing.py`
206
+ - report substitution: `report.py`
207
+ - CLI: `cli.py` via `scripts/okstra-token-usage.py` and `okstra token-usage`
208
+
209
+ ### 4.6 `prompts/`
210
+
211
+ | Path | Role |
212
+ |---|---|
213
+ | `launch.template.md` | Lead prompt template rendered for each run |
214
+ | `profiles/_common-contract.md` | Shared phase contract |
215
+ | `profiles/<task-type>.md` | English phase profiles |
216
+ | `profiles/kr/<task-type>.md` | Korean phase profile mirrors |
217
+ | `wizard/prompts.ko.json` | Korean wizard prompt single source of truth |
218
+
219
+ ### 4.7 `templates/`
220
+
221
+ | Path | Role |
222
+ |---|---|
223
+ | `templates/reports/final-report.template.md` | Jinja2 final-report Markdown template |
224
+ | `templates/reports/report.css`, `report.js` | Inline assets for self-contained HTML report view |
225
+ | `templates/reports/*.template.md` | Inputs, schedule, user-response, settings templates |
226
+ | `templates/prd/brief.template.md` | Brief template |
227
+ | `templates/project-docs/task-index.template.md` | Project task index template |
228
+ | `templates/okstra.CLAUDE.md` | Per-project okstra guidance import target |
229
+
230
+ ### 4.8 `schemas/`
231
+
232
+ `schemas/final-report-v1.0.schema.json` is the final-report data.json contract. The report-writer worker writes `final-report-<task-type>-<seq>.data.json`; the renderer produces Markdown from that JSON.
233
+
234
+ ### 4.9 `validators/`
235
+
236
+ | File | Role |
237
+ |---|---|
238
+ | `validate-run.py` | Run/final-report contract validation |
239
+ | `validate-brief.py`, `validate-brief.sh` | Brief frontmatter/body contract validation |
240
+ | `validate-report-views.py` | Slim/HTML view validation |
241
+ | `validate-schedule.py` | Schedule section/order/code validation |
242
+ | `validate-implementation-plan-stages.py` | Stage Map 구조 강제 — S1–S8 규칙 검사 (`## 4.5 Stage Map` + `## 4.5.<i> Stage <i>` 섹션, stage 당 step ≤ 6 등) |
243
+ | `validate_improvement_report.py` | improvement-discovery final-report 의 11항목 contract 강제. `validate-run.py` 가 `task_type == "improvement-discovery"` 일 때 자동 호출 |
244
+ | `validate-workflow.sh` | End-to-end fixture workflow validation |
245
+ | `lib/*.sh` | Shared shell validator helpers and fixtures |
246
+
247
+ ### 4.10 `skills/`
248
+
249
+ 13 installed skills:
250
+
251
+ | Skill | User-invocable | Role |
252
+ |---|---:|---|
253
+ | `okstra-brief` | yes | Produce task brief from ticket/doc/link/conversation |
254
+ | `okstra-run` | yes | Start/resume okstra task in current Claude Code session |
255
+ | `okstra-status` | yes | Inspect/update task lifecycle state |
256
+ | `okstra-history` | yes | List previous runs and choose resume points |
257
+ | `okstra-schedule` | yes | Generate task-group schedule |
258
+ | `okstra-setup` | yes | Install/check runtime and register project |
259
+ | `okstra-logs` | yes | Inspect wrapper log sidecars; suggest cleanup commands |
260
+ | `okstra-context-loader` | no | Load task bundle paths/manifests for phase start |
261
+ | `okstra-team-contract` | no | Worker roster/model/rule contract |
262
+ | `okstra-convergence` | no | Cross-worker convergence and plan-body verification |
263
+ | `okstra-report-writer` | no | Final report data.json authoring flow |
264
+ | `okstra-report-finder` | no | Locate/read previous reports |
265
+ | `okstra-time-summary` | no | Duration/time breakdown |
266
+
267
+ ### 4.11 `agents/`
268
+
269
+ | File | Role |
270
+ |---|---|
271
+ | `agents/SKILL.md` | Lead operating contract |
272
+ | `agents/workers/claude-worker.md` | Claude analyzer/verifier/executor spec |
273
+ | `agents/workers/codex-worker.md` | Codex analyzer/verifier/executor wrapper spec |
274
+ | `agents/workers/gemini-worker.md` | Gemini analyzer/verifier/executor wrapper spec |
275
+ | `agents/workers/report-writer-worker.md` | data.json SSOT author and audit sidecar writer |
276
+
277
+ ### 4.12 `tests/` and `tests-e2e/`
278
+
279
+ - `tests/`: 61 pytest modules covering project resolver, run preparation, worktrees, final-report rendering, validators, wizard, token usage, config, wrapper status, etc.
280
+ - `tests-e2e/`: 5 shell scenarios covering record-start/reconcile, rerun, task lock, agent install, and report view rendering.
263
281
 
264
282
  ---
265
283
 
266
- ### 3.11 `docs/` 문서
284
+ ## 5. 주요 런타임 모듈
267
285
 
268
- - `docs/kr/architecture.md` 내부 아키텍처
269
- - `docs/kr/cli.md` — `okstra.sh` 인자 레퍼런스
270
- - `docs/superpowers/plans/`, `docs/superpowers/specs/` — 내부 설계
286
+ ### 5.1 Prepare flow
271
287
 
272
- ---
288
+ `prepare_task_bundle()` coordinates:
273
289
 
274
- ## 4. Python 주요 모듈 · 클래스 요약
290
+ 1. Resolve project root and verify/upsert `project.json`.
291
+ 2. Resolve profile, required workers, model assignments, executor provider.
292
+ 3. Compute task/run paths and persist run context under `runs/<task-type>/manifests/`.
293
+ 4. Provision or reuse the task-key worktree.
294
+ 5. Materialize `instruction-set/` files and lead prompt snapshot.
295
+ 6. Persist run inputs, team state, task manifest, task index, run manifest, timeline, discovery pointers.
296
+ 7. Record the run in `~/.okstra/{active,recent}.jsonl` and project index.
275
297
 
276
- ### 4.1 데이터 클래스 (`okstra_ctl.models`)
298
+ ### 5.2 Worktree model
277
299
 
278
- - `PrepareInputs` — Task 입력 (task-type, brief path, projectId, models, base-ref, executor 등)
279
- - `PrepareOutputs` — 산출물 경로 + 메타 (run_id, run_dir, manifest_path 등)
280
- - `ModelAssignment` — Worker 모델 할당 (claude_worker_model / codex_executor_model / gemini_worker_model)
281
- - `WorktreeEntry`, `WorktreeProvision` — Git worktree 메타
300
+ One task-key owns one worktree:
282
301
 
283
- ### 4.2 주요 함수
302
+ ```text
303
+ ~/.okstra/worktrees/<project-id>/<task-group>/<task-id>/
304
+ ```
284
305
 
285
- - `prepare_task_bundle(inp)` — 단일 권위 진입점
286
- - `compute_run_paths(ctx)` — Run 디렉토리 구조 계산
287
- - `render_*()` — 9개 산출물 렌더
288
- - `workflow_state(task_type, current_phase)` — 다음 phase 추천
289
- - `reconcile_active(run_id)` — Active run 상태 수집
290
- - `list_runs(project_root, since, filter)` — 과거 runs 조회
291
- - `build_run_id(project_id, task_group, task_id, seq)` — Run ID 조합
306
+ Branch name:
292
307
 
293
- ### 4.3 보조 영역
308
+ ```text
309
+ <work-category-prefix>-<task-id-segment>
310
+ ```
294
311
 
295
- - `okstra_project`: `resolve_project_root(cwd)`, `load_project_meta()`, `upsert_project_meta()`
296
- - `okstra_token_usage`: `collect()`, `claude_cost_usd()`, `codex_cost_usd()`, `gemini_cost_usd()`, `substitute_final_report()`
312
+ The same worktree/branch is reused across all phases. `worktreeSyncDirs`, `worktreeSyncFiles`, and `worktreeSnapshotFiles` provide filesystem continuity only; they do not expand okstra's context/write boundary.
297
313
 
298
- ---
314
+ ### 5.3 Final report model
299
315
 
300
- ## 5. Node.js 주요 모듈 요약
316
+ Current report pipeline:
301
317
 
302
- 모든 ES 모듈은 `(args) Promise<number>` 시그니처. `bin/okstra`가 동적 import로 라우팅한다.
318
+ 1. Analysis workers write worker result files.
319
+ 2. Convergence writes `state/convergence-<task-type>-<seq>.json` when applicable.
320
+ 3. Report-writer worker writes `reports/final-report-<task-type>-<seq>.data.json`.
321
+ 4. `scripts/okstra-render-final-report.py` renders Markdown.
322
+ 5. Token usage substitution fills usage/cost cells.
323
+ 6. `scripts/okstra-render-report-views.py` emits `.slim.md` and `.html`.
303
324
 
304
- | 카테고리 | 모듈 |
305
- |---------|------|
306
- | 설치 | `install.mjs`, `uninstall.mjs` |
307
- | 진단 | `doctor.mjs`, `paths.mjs`, `version.mjs` |
308
- | 프로젝트 | `setup.mjs`, `check-project.mjs` |
309
- | Task 조회 | `task-list.mjs`, `task-show.mjs` |
310
- | 실행 보조 | `worktree-lookup.mjs`, `plan-validate.mjs`, `render-bundle.mjs` |
311
- | 스킬 구동 | `wizard.mjs` |
325
+ The Markdown is derived, not the authoring source. The schema is the contract.
312
326
 
313
327
  ---
314
328
 
315
- ## 6. 런타임 저장소 구조 (설치 후)
329
+ ## 6. 설치 저장소 구조
316
330
 
317
- ```
331
+ ```text
318
332
  ~/.okstra/
319
333
  ├── version
320
- ├── lib/python/{okstra_ctl, okstra_project, okstra_token_usage, lib/}
321
- ├── bin/{okstra.sh, okstra-codex-exec.sh, okstra-gemini-exec.sh, *.py}
322
- ├── recent.jsonl 모든 runs 기록 (최신순)
323
- ├── active.jsonl 진행 중인 runs
324
- ├── worktrees/registry.json worktree 레지스트리
325
- ├── projects/ 프로젝트별 메타 미러
326
- └── archive/ 완료된 runs
327
-
328
- ~/.claude/skills/okstra-*/SKILL.md 12개 슬래시 커맨드
334
+ ├── lib/python/{okstra_ctl,okstra_project,okstra_token_usage,okstra_vendor,lib/}
335
+ ├── bin/{okstra.sh,okstra-codex-exec.sh,okstra-gemini-exec.sh,...}
336
+ ├── templates/
337
+ ├── installed-skills.json
338
+ ├── installed-agents.json
339
+ ├── active.jsonl
340
+ ├── recent.jsonl
341
+ ├── projects/<project-id>/{meta.json,index.jsonl}
342
+ ├── worktrees/{registry.json,registry.lock,<project>/<group>/<task>/}
343
+ ├── archive/
344
+ └── .locks/
345
+
346
+ ~/.claude/skills/okstra-*/SKILL.md
329
347
  ~/.claude/agents/{claude,codex,gemini,report-writer}-worker.md
330
348
 
331
349
  <PROJECT_ROOT>/.project-docs/okstra/
332
- ├── project.json {projectId, projectRoot, ...}
333
- ├── discovery/{task-catalog.json, latest-task.json}
334
- └── tasks/<task-group>/<task-id>/<seq>/
350
+ ├── project.json
351
+ ├── CLAUDE.md
352
+ ├── glossary.md
353
+ ├── decisions/<NNNN>-<slug>.md
354
+ ├── discovery/{task-catalog.json,latest-task.json}
355
+ └── tasks/<task-group>/<task-id>/
335
356
  ├── task-manifest.json
336
- ├── run-context.json
337
- ├── runs/<phase>/ phase별 입력·산출
338
- ├── reports/final-report.md
339
- └── sessions/ Lead/Worker transcript
357
+ ├── task-index.md
358
+ ├── history/timeline.json
359
+ └── runs/<task-type>/
360
+ ├── instruction-set/
361
+ ├── manifests/
362
+ ├── state/
363
+ ├── prompts/
364
+ ├── reports/
365
+ ├── status/
366
+ ├── sessions/
367
+ ├── worker-results/
368
+ ├── user-responses/
369
+ ├── carry/ # implementation 전용: stage-<N>.json evidence sidecar
370
+ ├── logs/
371
+ └── (consumers.jsonl) # implementation-planning 전용: impl-run 역링크 누적 파일
340
372
  ```
341
373
 
342
- ---
343
-
344
- ## 7. 주요 워크플로우
345
-
346
- ### 7.1 새 Task 시작 (`/okstra-run`)
374
+ Project-local `<PROJECT_ROOT>/.claude/settings.local.json`, `<PROJECT_ROOT>/.project-docs/okstra/CLAUDE.md`, and `<PROJECT_ROOT>/AGENTS.md` are provisioned as symlink/import helpers so spawned agents can load okstra permissions and guidance.
347
375
 
348
- 1. **Step 0** — `okstra ensure-installed`, `okstra paths --shell`
349
- 2. **Step 1** — `okstra check-project --json`로 프로젝트 검증
350
- 3. **Step 2** — 기존 vs 신규 task 선택
351
- 4. **Step 3** — 입력 수집 (task-type, brief, model, executor, base-ref)
352
- 5. **Step 4** — `prepare_task_bundle(PrepareInputs)` 호출
353
- - Task key 생성 / 검증
354
- - Git worktree 자동 프로비저닝 (첫 phase)
355
- - 9개 산출물 렌더
356
- - `~/.okstra/recent.jsonl` 기록
357
- 6. **Step 5** — Lead 프롬프트 로드 후 `exec claude`
376
+ ---
358
377
 
359
- ### 7.2 Phase Routing
378
+ ## 7. 핵심 워크플로우
360
379
 
361
- `requirements-discovery error-analysis → implementation-planning → implementation → final-verification → release-handoff`
380
+ ### 7.1 First setup
362
381
 
363
- phase의 허용/금지 규칙은 `prompts/profiles/<task-type>.md` + `_common-contract.md`로 정의된다.
382
+ 1. `okstra install`
383
+ 2. `okstra doctor`
384
+ 3. inside target repo: `okstra setup --project-id <id>` or `/okstra-setup`
364
385
 
365
- ### 7.3 Worker 검증 (Phase 4-5)
386
+ ### 7.2 Brief creation
366
387
 
367
- - **Codex executor**: worktree 코드 편집 + commit
368
- - **Gemini verifier**: read-only 코드 리뷰 (선택)
369
- - **Claude verifier**: read-only 최종 검증
370
- - **Consensus**: Lead가 여러 verifier 판정을 종합 (`okstra-convergence`)
388
+ `/okstra-brief` turns source material into a validated task brief. It preserves source material verbatim, labels okstra augmentation, and records reporter confirmations.
371
389
 
372
- ### 7.4 최종 보고서 (Phase 6-7)
390
+ ### 7.3 Task run
373
391
 
374
- - **Phase 6 release-handoff**: Commit / PR 초안, 사용자 선택
375
- - **Phase 7 report-writer**: 최종 보고서 작성 후 archive
392
+ `/okstra-run` or `~/.okstra/bin/okstra.sh` collects task inputs and calls `prepare_task_bundle()`. The lead then works from the rendered instruction-set.
376
393
 
377
- ---
394
+ ### 7.4 Phase flow
378
395
 
379
- ## 8. PRD 작성을 위한 다음 단계
396
+ | Phase | Purpose | Typical next step |
397
+ |---|---|---|
398
+ | `requirements-discovery` | Classify and route work | `error-analysis` or `implementation-planning` |
399
+ | `error-analysis` | Reproduce and explain failure | `implementation-planning` |
400
+ | `implementation-planning` | Compare options, produce approval-ready plan; 산출은 항상 `## 4.5 Stage Map` + N 개의 `## 4.5.<i> Stage <i>` 섹션 구조. `implementation` 은 stage 단위로 분할 실행 가능 | `implementation` after approval |
401
+ | `implementation` | Executor changes code, verifiers check independently | `final-verification` |
402
+ | `final-verification` | Read-only acceptance verification | `release-handoff` if accepted |
403
+ | `release-handoff` | User-selected commit/PR handoff | done or follow-up |
380
404
 
381
- 문서는 다음 PRD 작성 단계에서 다음 항목의 입력 자료가 된다:
405
+ ### 7.5 Report and follow-up
382
406
 
383
- 1. **제품 정의**: §1 정체성 PRD의 Problem / Solution
384
- 2. **사용자 흐름**: §7 워크플로우 → User Journey
385
- 3. **기능 명세**: §3.7 Skills 12종, §3.6 Worker 4종, §4.2 주요 함수 → Feature list
386
- 4. **시스템 경계**: §6 런타임 저장소 → System Architecture
387
- 5. **검증 기준**: §3.5 validators, §3.10 tests → Acceptance Criteria
407
+ Final report artifacts live under `runs/<task-type>/reports/`. Human responses from the HTML view are saved as `runs/<task-type>/user-responses/user-response-<task-type>-<seq>.md` and can be carried into the next run.
388
408
 
389
409
  ---
390
410
 
391
- ## 부록 A. 보고서 row ID prefix 용어집
392
-
393
- okstra 가 산출하는 final-report 와 worker-result 의 표·리스트는 섹션별 두-글자 prefix 로 행을 식별합니다. 같은 prefix 는 어느 task / phase / project 에서도 의미가 동일하므로, 한 run 의 `C-005` 를 후속 run 이나 follow-up task 에서 그대로 인용해 cross-reference 할 수 있습니다.
394
-
395
- ### A.1 Final-report 행 ID
396
-
397
- | Prefix | 의미 | 정의 위치 (template / contract) |
398
- |--------|------|----------------------------------|
399
- | `P-NNN` | Problem / Verification Target — 본 run 이 해결하려는 문제·검증 대상 한 줄 요약 | `## Summary of the Problem or Verification Target` |
400
- | `C-NNN` | Consensus — 모든 worker 가 합의한 결론 | `### 1.1 Consensus` |
401
- | `D-NNN` | Differences — worker 간 의미 있는 불일치 | `### 1.2 Differences` |
402
- | `E-NNN` | Primary Evidence — 본 verdict 의 1차 근거 | `### 3.1 Primary Evidence` |
403
- | `S-NNN` | Secondary Evidence / Alternate Interpretations — 보조 근거·대안 해석 | `### 3.2 Secondary Evidence or Alternate Interpretations` |
404
- | `R-NNN` | Missing Information / Risks — 누락 정보·인지된 위험 | `## 4. Missing Information and Risks` |
405
- | `RR-NNN` | Residual Risk — verdict 를 막진 않지만 추적해야 하는 잔여 위험 | `### 4.2 Residual Risk` |
406
- | `OF-NNN` | Option File-structure rows — implementation-planning 의 옵션별 파일 책임 | `### 4.5.1 Option Candidates` |
407
- | `DM-NNN` | Dependency / Migration risk — 순서·백필·feature-flag 선행 조건 | `### 4.5.5 Dependency / Migration Risk` |
408
- | `RB-NNN` | Rollback step — revert 경로·트리거 신호 | `### 4.5.7 Rollback Strategy` |
409
- | `OQ-NNN` | Open Question — pre-planning 에서 발견된 모호점 | `### 4.5.9 Open Questions` |
410
- | `FU-NNN` | Follow-up Task — 본 run 범위 밖이지만 후속 처리해야 하는 항목 | `## 7. Follow-up Tasks` |
411
- | `FU-VNN` | Verifier-harness Follow-up — verifier 환경 결함을 잡는 후속 (okstra 본체 fix) | `## 7.` (lead synthesis, `Origin = manual` 표기) |
412
- | `A1, A2, …` | Additional materials requested — 다음 run 시작 전 사용자가 채워야 할 자료 요청. **run 사이에 ID 유지**, 답변 완료 시 `Status` 만 갱신 | `### 5.1 추가 자료 요청` |
413
- | `Q1, Q2, …` | Questions for the user — 동일 규칙으로 run 간 ID 유지 | `### 5.2 사용자 확인 질문` |
411
+ ## 8. 문서 유지보수 체크리스트
414
412
 
415
- ### A.2 Worker-result ID (worker 자기 output 안에서 매기는 ID)
413
+ When changing code, keep these docs in sync:
416
414
 
417
- `okstra-team-contract` 정의하는 worker output 6개 섹션 중 1, 2 섹션이 prefix 갖습니다.
415
+ - New Node command: update `bin/okstra` usage, `README*`, this file, and `docs/kr/cli.md`.
416
+ - New runtime source copied to users: update `tools/build.mjs`, install/uninstall manifests if applicable, and this file.
417
+ - New skill/agent: update `README*`, this file, install/uninstall fallback lists, and `CHANGES.md`.
418
+ - New report field/section: update schema, template, report-writer worker, validator tests, this file's report model if user-visible.
419
+ - New phase/profile behavior: update `prompts/profiles/*`, `docs/kr/architecture.md`, `docs/kr/cli.md`, and `README*` if user-facing.
418
420
 
419
- | Prefix | 의미 | Worker output 섹션 |
420
- |--------|------|-------------------|
421
- | `F-NNN` | Finding — worker 의 핵심 발견 | §1 Findings |
422
- | `M-NNN` | Missing Information / Assumption — worker 가 인지한 누락 정보·가정 | §2 Missing Information or Assumptions |
423
-
424
- §3 Safe Areas, §4 Uncertain Points, §5 Recommended Next Actions, §6 Specialization Lens 는 표 형태가 아니라 별도 prefix 가 없습니다.
425
-
426
- ### A.3 Phase / 입력 도메인 약어
427
-
428
- | 약어 | 의미 |
429
- |------|------|
430
- | `AC` | Acceptance Criteria — `final-verification-input.template.md` 의 `## Acceptance Criteria` 섹션에 사용자가 적어두는 합격 기준 (예: `AC1`, `AC2`, … `AC10`). Verifier 는 한 AC 당 한 줄로 `covered` / `not covered` 판정 |
431
- | `OQ` | Open Question — implementation-planning 의 `### 4.5.9` 행 ID. final-report 의 다른 섹션에서 `OQ-A`, `OQ-D` 처럼 알파벳 인덱스로도 인용됨 |
432
- | `FU-V` | Follow-up — Verifier harness 카테고리. `okstra-codex-exec.sh`, worktree provisioner 등 okstra 본체의 verifier 환경 결함을 잡는 후속 task |
433
-
434
- ### A.4 Ticket / Verdict 토큰
421
+ ---
435
422
 
436
- | 토큰 | 위치 | 허용 |
437
- |------|------|---------|
438
- | `Verdict Token` | `## 2. Final Verdict` | `accepted`, `conditional-accept`, `blocked`, `not-applicable` (final-verification 만 의미 있음, release-handoff 가 진입 gate 로 사용) |
439
- | `Direction` | `## 2. Final Verdict` | `continue-investigation`, `begin-implementation`, `approve`, `reject`, `hold` |
440
- | `Ticket ID` | 모든 행 표에 컬럼으로 등장 | brief 의 `Issue / Ticket` 비어 있으면 `Task ID` → 둘 다 없으면 `unknown` |
423
+ ## 부록 A. Report / row ID 용어
424
+
425
+ | Prefix / token | Meaning |
426
+ |---|---|
427
+ | `P-NNN` | Problem / verification target summary |
428
+ | `C-NNN` | Consensus or clarification item, depending on section context |
429
+ | `D-NNN` | Difference between workers |
430
+ | `E-NNN` | Primary evidence |
431
+ | `S-NNN` | Secondary evidence or alternate interpretation |
432
+ | `R-NNN` | Missing information / risk |
433
+ | `RR-NNN` | Residual risk |
434
+ | `P-Opt-*` | Plan option item used by plan-body verification |
435
+ | `P-Step-*` | Plan execution step item |
436
+ | `P-Dep-*` | Plan dependency / migration item |
437
+ | `P-Val-*` | Plan validation checklist item |
438
+ | `P-Rb-*` | Plan rollback item |
439
+ | `FU-NNN` | Follow-up task |
440
+ | `worker:item` | Source item pointer preserved from worker result into final report |
441
+ | `Verdict Token` | `accepted`, `conditional-accept`, `blocked`, `not-applicable` |
442
+ | `Direction` | `continue-investigation`, `begin-implementation`, `approve`, `reject`, `hold` |
443
+
444
+ Clarifications now live in the unified `## 5. Clarification Items` table. Deprecated `5.1` / `5.2` split sections are no longer part of the schema.
441
445
 
442
446
  ---
443
447
 
444
- *작성일: 2026-05-14 · 분석 대상: `claude/objective-einstein-250add` 브랜치 기준 okstra v0.20.1*
448
+ *Updated: 2026-05-20 · Source of truth checked against `package.json`, `bin/okstra`, `tools/build.mjs`, `scripts/`, `skills/`, `agents/`, `templates/`, `schemas/`, `validators/`, and tests.*