codex-genesis-harness 0.1.7 → 0.1.9

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 (115) hide show
  1. package/.codebase/COMPRESSED_CONTEXT.md +80 -0
  2. package/.codebase/CURRENT_STATE.md +10 -10
  3. package/.codebase/DEPENDENCY_GRAPH.md +14 -1
  4. package/.codebase/IMPLEMENTATION_HANDOFF.md +34 -336
  5. package/.codebase/KNOWN_PROBLEMS.md +73 -3
  6. package/.codebase/MODULE_INDEX.md +23 -2
  7. package/.codebase/PIPELINE_FLOW.md +16 -6
  8. package/.codebase/RECOVERY_POINTS.md +80 -78
  9. package/.codebase/TECH_DEBT.md +6 -0
  10. package/.codebase/TEST_MATRIX.md +8 -3
  11. package/.codebase/VISUAL_GRAPH.md +127 -0
  12. package/.codebase/context-policy.json +68 -0
  13. package/.codebase/memories/lessons_learned.md +63 -0
  14. package/.codebase/memories/preferences.md +17 -0
  15. package/.codebase/state.json +156 -17
  16. package/.codex/skills/genesis-architecture/SKILL.md +5 -0
  17. package/.codex/skills/genesis-debug-guide/SKILL.md +10 -4
  18. package/.codex/skills/genesis-docs-automation/SKILL.md +52 -973
  19. package/.codex/skills/genesis-executing-plans/SKILL.md +54 -0
  20. package/.codex/skills/genesis-executing-plans/agents/openai.yaml +6 -0
  21. package/.codex/skills/genesis-executing-plans/checklists/.gitkeep +0 -0
  22. package/.codex/skills/genesis-executing-plans/examples/.gitkeep +0 -0
  23. package/.codex/skills/genesis-executing-plans/templates/.gitkeep +0 -0
  24. package/.codex/skills/genesis-harness/SKILL.md +73 -1385
  25. package/.codex/skills/genesis-harness/agents/openai.yaml +1 -2
  26. package/.codex/skills/genesis-harness/references/state-machine.md +4 -1
  27. package/.codex/skills/genesis-harness/references/workflows.md +7 -1
  28. package/.codex/skills/genesis-harness/scripts/check-docs-sync.sh +3 -3
  29. package/.codex/skills/genesis-harness/scripts/init-planning.sh +246 -14
  30. package/.codex/skills/genesis-new-design/SKILL.md +4 -1
  31. package/.codex/skills/genesis-new-design/agents/openai.yaml +2 -0
  32. package/.codex/skills/genesis-observability-automation/SKILL.md +69 -303
  33. package/.codex/skills/genesis-observability-automation/references/common-mistakes-and-recovery.md +84 -0
  34. package/.codex/skills/genesis-observability-automation/references/workflow-phases.md +78 -0
  35. package/.codex/skills/genesis-performance-profiling/SKILL.md +1 -22
  36. package/.codex/skills/genesis-performance-profiling/agents/openai.yaml +1 -1
  37. package/.codex/skills/genesis-pipeline-orchestration/SKILL.md +15 -3
  38. package/.codex/skills/genesis-planning/SKILL.md +6 -1
  39. package/.codex/skills/genesis-release/SKILL.md +5 -0
  40. package/.codex/skills/genesis-research-first/SKILL.md +6 -0
  41. package/.codex/skills/genesis-spec-propagation/SKILL.md +52 -504
  42. package/.codex/skills/genesis-test-driven-development/SKILL.md +55 -0
  43. package/.codex/skills/genesis-test-driven-development/agents/openai.yaml +6 -0
  44. package/.codex/skills/genesis-test-driven-development/checklists/.gitkeep +0 -0
  45. package/.codex/skills/genesis-test-driven-development/examples/.gitkeep +0 -0
  46. package/.codex/skills/genesis-test-driven-development/templates/.gitkeep +0 -0
  47. package/.codex/skills/genesis-upgrade-design/SKILL.md +4 -2
  48. package/.codex/skills/genesis-upgrade-design/agents/openai.yaml +2 -0
  49. package/.codex/skills/genesis-using-git-worktrees/SKILL.md +54 -0
  50. package/.codex/skills/genesis-using-git-worktrees/agents/openai.yaml +6 -0
  51. package/.codex/skills/genesis-using-git-worktrees/checklists/.gitkeep +0 -0
  52. package/.codex/skills/genesis-using-git-worktrees/examples/.gitkeep +0 -0
  53. package/.codex/skills/genesis-using-git-worktrees/templates/.gitkeep +0 -0
  54. package/.codex/skills/genesis-verification-before-completion/SKILL.md +53 -0
  55. package/.codex/skills/genesis-verification-before-completion/agents/openai.yaml +6 -0
  56. package/.codex/skills/genesis-verification-before-completion/checklists/.gitkeep +0 -0
  57. package/.codex/skills/genesis-verification-before-completion/examples/.gitkeep +0 -0
  58. package/.codex/skills/genesis-verification-before-completion/templates/.gitkeep +0 -0
  59. package/.codex/skills/spec-impact-engine/SKILL.md +77 -500
  60. package/.codex/skills/spec-impact-engine/checklists/checklist.md +10 -0
  61. package/.codex-plugin/plugin.json +6 -5
  62. package/CHANGELOG.md +25 -1
  63. package/README.EN.md +74 -17
  64. package/README.VI.md +77 -19
  65. package/README.md +126 -10
  66. package/VERSION +1 -2
  67. package/bin/genesis-harness.js +2979 -149
  68. package/contracts/features/project-registry-schema.json +37 -0
  69. package/contracts/features/registry-schema.json +15 -0
  70. package/contracts/observability/agent-run-schema.json +39 -0
  71. package/contracts/observability/failure-schema.json +35 -0
  72. package/contracts/ui/auth/login-screen-contract.json +43 -0
  73. package/features/REGISTRY.md +65 -0
  74. package/features/SCOPE-template.md +65 -0
  75. package/fixtures/pipeline/end-to-end-project-lifecycle-fixture.md +39 -0
  76. package/fixtures/pipeline/feature-completion-fixture.md +26 -0
  77. package/fixtures/pipeline/run-to-feature-execution-fixture.md +20 -0
  78. package/fixtures/planning/MOCKUP_PROMPT_TEMPLATE.md +16 -0
  79. package/observability/agent-runs/sample-run.json +13 -0
  80. package/observability/decision-logs/sample-decision.md +43 -0
  81. package/observability/failures/sample-failure.json +12 -0
  82. package/package.json +15 -4
  83. package/playwright/e2e/app-template.spec.js +37 -0
  84. package/playwright/e2e/auth/login-screen.spec.js +65 -0
  85. package/playwright/e2e/web-template.spec.js +28 -0
  86. package/scripts/check-repository-hygiene.js +48 -0
  87. package/scripts/check-scope.sh +100 -0
  88. package/scripts/cold-start-check.js +133 -0
  89. package/scripts/install.sh +4 -0
  90. package/scripts/prompt_sentinel.js +35 -4
  91. package/scripts/run-evals.sh +152 -3
  92. package/scripts/schema/001-init.sql +129 -0
  93. package/scripts/schema/002-story-verify.sql +9 -0
  94. package/scripts/schema/003-tool-registry.sql +15 -0
  95. package/scripts/schema/004-intervention.sql +15 -0
  96. package/scripts/scratch_parser.js +49 -0
  97. package/scripts/spec_visual_sync.js +1 -1
  98. package/scripts/test_generator.js +2 -2
  99. package/scripts/transition_state.sh +32 -8
  100. package/scripts/uninstall.sh +4 -0
  101. package/scripts/validation_gates.sh +2 -80
  102. package/scripts/verify.sh +19 -2
  103. package/tests/fixtures/fixture-index.md +5 -0
  104. package/tests/integration/cli-smoke.test.js +506 -0
  105. package/tests/unit/feature_registry.test.js +152 -0
  106. package/tests/unit/prompt_sentinel.test.js +1 -1
  107. package/tests/unit/repository_hygiene.test.js +17 -0
  108. package/tests/unit/spec_visual_sync.test.js +1 -1
  109. package/tests/unit/state_metadata.test.js +76 -0
  110. package/tests/unit/test_generator.test.js +1 -1
  111. package/tests/unit/verify_gate.test.js +25 -0
  112. package/tests/unit/workflow_contracts.test.js +90 -0
  113. package/fixtures/tts/tts-fixture-template.md +0 -14
  114. package/fixtures/videos/video-fixture-template.md +0 -14
  115. package/playwright/e2e/e2e-template.md +0 -4
@@ -2,8 +2,7 @@ interface:
2
2
  display_name: "Genesis Harness"
3
3
  short_description: "— Lập kế hoạch, giám sát và kiểm thử dự án"
4
4
  brand_color: "#2563EB"
5
- default_prompt: "Use $genesis-harness to initialize planning and operate this repository with test-first workflows."
5
+ default_prompt: "Use $genesis-harness to initialize planning and operate this repository with test-first workflows. If the repo is blank and the user gives only an idea, treat that as implicit init, seed planning docs from the brief, then use the deterministic run pipeline to persist discovery QA and tech stack decisions."
6
6
 
7
7
  policy:
8
8
  allow_implicit_invocation: true
9
-
@@ -16,19 +16,22 @@ The Genesis Harness operates in the following strict states:
16
16
  3. `PLANNING`: Creating `implementation_plan.md` and writing tests.
17
17
  4. `IMPLEMENTATION`: Writing code to satisfy tests and plan.
18
18
  5. `VERIFICATION`: Running test scripts (`verify.sh`) and validating constraints.
19
- 6. `COMPLETED`: All tests pass, docs are updated, ready for the next task.
19
+ 6. `RELEASE_READY`: Every feature proof and the project proof passed; the final handoff exists.
20
+ 7. `COMPLETED`: Release or acceptance evidence has been recorded after `RELEASE_READY`.
20
21
 
21
22
  ## Rules of State Transition
22
23
 
23
24
  - **NEVER** skip a state directly (e.g., from `REQUIREMENTS_GATHERING` to `IMPLEMENTATION` without `PLANNING`).
24
25
  - **ALWAYS** use the strict transition script to change states: `bash scripts/transition_state.sh <NEW_STATE> "Reason for transition"`
25
26
  - **ALWAYS** read `.codebase/state.json` when you start a new conversation or wake up, to know exactly where you left off.
27
+ - **NEVER** transition directly from `VERIFICATION` to `COMPLETED`; project-wide verification must produce `RELEASE_READY` first.
26
28
 
27
29
  ## Handling Interruptions
28
30
  If the user's connection drops or you are restarted:
29
31
  1. Read `.codebase/state.json`
30
32
  2. If `current_state` is `IMPLEMENTATION`, resume coding based on the `task.md`.
31
33
  3. If `current_state` is `VERIFICATION`, resume running test scripts.
34
+ 4. If `current_state` is `RELEASE_READY`, inspect the implementation handoff and record release or acceptance evidence before completion.
32
35
 
33
36
  ## The State File
34
37
  The state is persisted in `.codebase/state.json`. **Do not edit this file manually.** Always use the `transition_state.sh` script to ensure validation gates are respected.
@@ -14,6 +14,13 @@ Use this file when the requested work is a feature, bug fix, plan, audit, review
14
14
  | Review changed files | `/review` |
15
15
  | Summarize current state | `/status` |
16
16
 
17
+ ## Empty Repository Rule
18
+
19
+ - If the repo does not contain `.planning/` and the user starts with an idea, brief, or requested product direction, run the initialization workflow automatically.
20
+ - Initialization is not blocked on the user typing `/init`.
21
+ - Immediately after initialization, seed the planning docs from the brief, then request discovery answers that close product approach, QA acceptance criteria, and tech stack.
22
+ - Prefer the deterministic bootstrap path: `genesis-harness run --yes --platform codex --idea "<user brief>"`.
23
+
17
24
  ## Readiness Gate
18
25
 
19
26
  - [ ] Intent is confirmed.
@@ -30,4 +37,3 @@ Use this file when the requested work is a feature, bug fix, plan, audit, review
30
37
  - [ ] Tracking files were updated.
31
38
  - [ ] Changed files were reviewed.
32
39
  - [ ] Unnecessary files, debug logs, and unrelated changes were removed.
33
-
@@ -11,8 +11,9 @@ if ! git rev-parse --is-inside-work-tree >/dev/null 2>&1; then
11
11
  fi
12
12
 
13
13
  changed="$(git diff --name-only HEAD 2>/dev/null || git diff --name-only)"
14
- docs_changed="$(printf '%s\n' "$changed" | grep -E '^(\.planning/|docs/|README\.md|AGENTS\.md)' || true)"
15
- code_changed="$(printf '%s\n' "$changed" | grep -Ev '^(\.planning/|docs/|README\.md|AGENTS\.md)$' || true)"
14
+ docs_pattern='^(\.planning/|\.codebase/|\.codex/SKILLS_INDEX\.md|docs/|README(\.[A-Z]{2})?\.md|AGENTS\.md|CHANGELOG\.md)'
15
+ docs_changed="$(printf '%s\n' "$changed" | grep -E "$docs_pattern" || true)"
16
+ code_changed="$(printf '%s\n' "$changed" | grep -Ev "$docs_pattern" || true)"
16
17
 
17
18
  if [ -n "$code_changed" ] && [ -z "$docs_changed" ]; then
18
19
  echo "Code changed but no planning/docs files changed."
@@ -21,4 +22,3 @@ if [ -n "$code_changed" ] && [ -z "$docs_changed" ]; then
21
22
  fi
22
23
 
23
24
  echo "Docs sync check passed or no code changes detected."
24
-
@@ -2,7 +2,9 @@
2
2
  set -euo pipefail
3
3
 
4
4
  confirmed="${PROJECT_BRIEF_CONFIRMED:-0}"
5
+ idea="${USER_IDEA:-}"
5
6
  root="."
7
+ script_source="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
6
8
 
7
9
  while [ "$#" -gt 0 ]; do
8
10
  case "$1" in
@@ -15,8 +17,12 @@ while [ "$#" -gt 0 ]; do
15
17
  [ -n "$root" ] || { echo "--root requires a path" >&2; exit 2; }
16
18
  shift 2
17
19
  ;;
20
+ --idea)
21
+ idea="${2:-}"
22
+ shift 2
23
+ ;;
18
24
  --help|-h)
19
- echo "Usage: $0 --confirmed [--root path]" >&2
25
+ echo "Usage: $0 --confirmed [--root path] [--idea \"user brief\"]" >&2
20
26
  echo "Or: PROJECT_BRIEF_CONFIRMED=1 $0 [--root path]" >&2
21
27
  exit 0
22
28
  ;;
@@ -42,11 +48,78 @@ fi
42
48
 
43
49
  cd "$root"
44
50
 
51
+ normalize_inline() {
52
+ printf '%s' "$1" | tr '\n' ' ' | sed 's/[[:space:]]\+/ /g; s/^ //; s/ $//'
53
+ }
54
+
55
+ trim_to_words() {
56
+ local text="$1"
57
+ local limit="${2:-8}"
58
+ printf '%s\n' "$text" | awk -v limit="$limit" '{
59
+ out="";
60
+ for (i = 1; i <= NF && i <= limit; i++) {
61
+ out = out (i == 1 ? "" : " ") $i
62
+ }
63
+ print out
64
+ }'
65
+ }
66
+
67
+ normalized_idea="$(normalize_inline "$idea")"
68
+ detected_stack="$(bash "$script_source/detect-stack.sh" "$root" 2>/dev/null || true)"
69
+
70
+ if [ -n "$normalized_idea" ]; then
71
+ idea_summary="$normalized_idea"
72
+ project_title="$(trim_to_words "$normalized_idea" 8)"
73
+ project_users="Users described in the brief and adjacent stakeholders."
74
+ core_value="Turn the idea into a focused v1 outcome without losing the original brief."
75
+ product_scope="- [ ] Build around this brief: $normalized_idea"
76
+ current_milestone="Phase 1 discovery and planning bootstrap"
77
+ success_criteria="- [ ] The first implementation plan stays aligned with this brief: $normalized_idea"
78
+ functional_requirements="- [ ] Support the core flow implied by the brief: $normalized_idea"
79
+ user_stories="- [ ] As a target user, I want the product described in this brief: $normalized_idea"
80
+ acceptance_criteria="- [ ] Discovery confirms scope, QA path, and tech stack for: $normalized_idea"
81
+ known_unknowns="- [ ] Confirm exact product approach, feature cut, and owners for: $normalized_idea"
82
+ summary_focus="- [ ] Bootstrap planning from the user idea: $normalized_idea"
83
+ summary_recent="- [ ] Init seeded planning docs from the first user brief."
84
+ summary_next="- [ ] Close INIT_QA.md and turn this brief into approved scope."
85
+ stack_direction="Product direction clue: $(printf '%s' "$normalized_idea" | cut -c1-140)"
86
+ else
87
+ idea_summary="No explicit user brief captured yet."
88
+ project_title="TBD"
89
+ project_users="TBD"
90
+ core_value="TBD"
91
+ product_scope="- [ ] TBD"
92
+ current_milestone="TBD"
93
+ success_criteria="- [ ] TBD"
94
+ functional_requirements="- [ ] TBD"
95
+ user_stories="- [ ] As a user, I want TBD so that TBD."
96
+ acceptance_criteria="- [ ] TBD"
97
+ known_unknowns="- [ ] TBD"
98
+ summary_focus="- [ ] Initialize harness and complete discovery / QA alignment."
99
+ summary_recent="- [ ] Initial planning skeleton and discovery phase created."
100
+ summary_next="- [ ] Answer INIT_QA.md and complete Phase 01 discovery artifacts."
101
+ stack_direction="Product direction clue: TBD"
102
+ fi
103
+
104
+ if printf '%s' "$normalized_idea" | grep -Eiq 'mobile|ios|android|responsive'; then
105
+ stack_hint="Mobile-first delivery is implied by the brief."
106
+ else
107
+ stack_hint="TBD"
108
+ fi
109
+
110
+ current_iso_utc="$(date -u +"%Y-%m-%dT%H:%M:%SZ")"
111
+ current_day_local="$(date +"%Y-%m-%d")"
112
+
45
113
  mkdir -p \
114
+ .codebase \
115
+ .codebase/context \
116
+ .codebase/failures \
117
+ .codebase/memories \
46
118
  .planning/diagrams \
47
119
  .planning/research \
48
120
  .planning/decisions \
49
121
  .planning/phases/00-foundation \
122
+ .planning/phases/01-discovery-and-qa \
50
123
  .planning/features \
51
124
  .planning/bugs \
52
125
  .planning/audits \
@@ -94,19 +167,19 @@ write_if_missing .planning/PROJECT.md <<'EOF'
94
167
 
95
168
  ## What This Project Is
96
169
 
97
- TBD
170
+ __PROJECT_WHAT__
98
171
 
99
172
  ## Target Users
100
173
 
101
- TBD
174
+ __PROJECT_USERS__
102
175
 
103
176
  ## Core Value
104
177
 
105
- TBD
178
+ __PROJECT_VALUE__
106
179
 
107
180
  ## Product Scope
108
181
 
109
- - [ ] TBD
182
+ __PROJECT_SCOPE__
110
183
 
111
184
  ## Out Of Scope
112
185
 
@@ -122,11 +195,11 @@ TBD
122
195
 
123
196
  ## Current Milestone
124
197
 
125
- TBD
198
+ __PROJECT_MILESTONE__
126
199
 
127
200
  ## Success Criteria
128
201
 
129
- - [ ] TBD
202
+ __PROJECT_SUCCESS__
130
203
  EOF
131
204
 
132
205
  write_if_missing .planning/REQUIREMENTS.md <<'EOF'
@@ -160,12 +233,13 @@ EOF
160
233
  write_if_missing .planning/ROADMAP.md <<'EOF'
161
234
  # Roadmap
162
235
 
163
- **Note**: Phase 0 (Foundation) is setup and documentation only. Feature phases will be added after requirements are finalized.
236
+ **Note**: Phase 0 (Foundation) is setup and documentation only. Phase 1 captures discovery, QA alignment, and tech stack sign-off before feature phases are planned.
164
237
 
165
238
  | Phase | Type | Status | Dependencies | Acceptance Criteria |
166
239
  |---|---|---|---|---|
167
240
  | 00 Foundation | Setup | [ ] | None | Project docs completed, requirements confirmed, harness verified |
168
- | TBD | Feature | [ ] | 00 Foundation | To be planned after requirements finalized |
241
+ | 01 Discovery & QA | Validation | [ ] | 00 Foundation | Product approach confirmed, QA checklist answered, tech stack signed off |
242
+ | TBD | Feature | [ ] | 01 Discovery & QA | To be planned after requirements finalized |
169
243
  EOF
170
244
 
171
245
  write_if_missing .planning/STATE.md <<'EOF'
@@ -175,7 +249,7 @@ Current project state: [ ] Initialized planning harness pending product confirma
175
249
  Current phase: 00 Foundation (Setup phase - documentation only)
176
250
  Current feature or bug: None
177
251
  Last completed task: None
178
- Next task: Confirm project brief and refine planning docs.
252
+ Next task: Run discovery Q&A to confirm product approach and tech stack.
179
253
  Blocked items: None
180
254
  Latest verification result: Not run
181
255
  EOF
@@ -408,15 +482,52 @@ write_if_missing .planning/SUMMARY.md <<'EOF'
408
482
 
409
483
  ## Current Focus
410
484
 
411
- - [ ] Initialize and confirm planning harness.
485
+ - [ ] Initialize harness and complete discovery / QA alignment.
412
486
 
413
487
  ## Recent Changes
414
488
 
415
- - [ ] Initial planning skeleton created.
489
+ - [ ] Initial planning skeleton and discovery phase created.
416
490
 
417
491
  ## Next Recommended Task
418
492
 
419
- - [ ] Confirm product brief and fill required planning docs.
493
+ - [ ] Answer INIT_QA.md and complete Phase 01 discovery artifacts.
494
+ EOF
495
+
496
+ write_if_missing .planning/INIT_QA.md <<'EOF'
497
+ # Init Discovery Q&A
498
+
499
+ Complete this immediately after `/init`. The next agent turn should request answers or explicit assumptions for every section below.
500
+
501
+ ## Product Direction
502
+
503
+ - [ ] What problem is this project solving?
504
+ - [ ] Who is the primary user?
505
+ - [ ] What is the smallest acceptable v1 outcome?
506
+ - [ ] What approaches were considered and which one is preferred?
507
+
508
+ ## QA Closure
509
+
510
+ - [ ] Happy path is described end-to-end.
511
+ - [ ] Failure and edge cases are listed.
512
+ - [ ] Out-of-scope items are explicitly captured.
513
+ - [ ] Acceptance criteria are measurable.
514
+ - [ ] QA sign-off owner is named.
515
+
516
+ ## Tech Stack Sign-Off
517
+
518
+ - [ ] Backend/runtime choice confirmed.
519
+ - [ ] Frontend/client choice confirmed.
520
+ - [ ] Storage/database choice confirmed.
521
+ - [ ] Test strategy confirmed.
522
+ - [ ] Deployment target confirmed.
523
+ - [ ] Final tech stack owner is named.
524
+
525
+ ## Required Output To User
526
+
527
+ Ask for a concise answer that closes:
528
+ 1. product approach
529
+ 2. tech stack
530
+ 3. QA sign-off / approval owner
420
531
  EOF
421
532
 
422
533
  write_if_missing .planning/config.json <<'EOF'
@@ -665,6 +776,56 @@ Review Phase 0 documentation quality.
665
776
  - [ ] Team confirms understanding
666
777
  EOF
667
778
 
779
+ write_if_missing .planning/phases/01-discovery-and-qa/PLAN.md <<'EOF'
780
+ # 01 Discovery & QA Plan
781
+
782
+ Phase 1 closes product direction before feature planning starts.
783
+
784
+ - [ ] Ask discovery questions from INIT_QA.md
785
+ - [ ] Confirm preferred product approach
786
+ - [ ] Confirm tech stack and deployment direction
787
+ - [ ] Record QA sign-off owner and acceptance criteria
788
+ - [ ] Update PROJECT.md, REQUIREMENTS.md, STACK.md, ROADMAP.md
789
+ - [ ] Mark feature planning ready
790
+ EOF
791
+ write_if_missing .planning/phases/01-discovery-and-qa/TASKS.md <<'EOF'
792
+ # 01 Discovery & QA Tasks
793
+
794
+ - [ ] Ask user to confirm product approach
795
+ - [ ] Ask user to confirm target users and success criteria
796
+ - [ ] Ask user to confirm backend, frontend, database, and deployment stack
797
+ - [ ] Run new-feature-qa checklist against current scope
798
+ - [ ] Run requirements-validation checklist
799
+ - [ ] Assign QA sign-off owner
800
+ - [ ] Update ADR-001-tech-stack.md with chosen stack
801
+ - [ ] Update PROJECT.md and REQUIREMENTS.md with approved direction
802
+ - [ ] Update STATE.md next task toward first feature plan
803
+ EOF
804
+ write_if_missing .planning/phases/01-discovery-and-qa/TESTS.md <<'EOF'
805
+ # 01 Discovery & QA Tests
806
+
807
+ - [ ] INIT_QA.md completed with no unresolved blockers
808
+ - [ ] STACK.md has confirmed stack values or documented assumptions
809
+ - [ ] QA owner and approval path recorded
810
+ - [ ] ROADMAP.md ready for first feature phase creation
811
+ EOF
812
+ write_if_missing .planning/phases/01-discovery-and-qa/VERIFICATION.md <<'EOF'
813
+ # 01 Discovery & QA Verification
814
+
815
+ - [ ] INIT_QA.md answered
816
+ - [ ] PROJECT.md, REQUIREMENTS.md, STACK.md updated
817
+ - [ ] ADR-001-tech-stack.md updated
818
+ - [ ] Next phase can be created without open product ambiguity
819
+ EOF
820
+ write_if_missing .planning/phases/01-discovery-and-qa/REVIEW.md <<'EOF'
821
+ # 01 Discovery & QA Review
822
+
823
+ - [ ] Product approach is explicit
824
+ - [ ] Tech stack is explicit
825
+ - [ ] QA sign-off path is explicit
826
+ - [ ] No blocking TBD remains for feature planning
827
+ EOF
828
+
668
829
  write_if_missing .planning/features/FEATURE_TEMPLATE.md <<'EOF'
669
830
  # Feature Template
670
831
 
@@ -694,6 +855,16 @@ write_if_missing .planning/checks/CHECKS.md <<'EOF'
694
855
  - [ ] Architecture boundaries
695
856
  - [ ] Project verification
696
857
  EOF
858
+
859
+ write_if_missing .codebase/PHASE_DEPENDENCY_MAP.md <<'EOF'
860
+ # Phase Dependency Map
861
+
862
+ | Phase | Depends On | Purpose |
863
+ |---|---|---|
864
+ | 00 Foundation | None | Bootstrap planning harness and baseline docs |
865
+ | 01 Discovery & QA | 00 Foundation | Close product direction, QA checklist, and tech stack sign-off |
866
+ | Feature phases (TBD) | 01 Discovery & QA | Implementation planning begins only after discovery is closed |
867
+ EOF
697
868
  for check in lint typecheck test build docs-sync architecture-fitness; do
698
869
  write_if_missing ".planning/checks/$check.md" <<EOF
699
870
  # $check
@@ -741,10 +912,71 @@ EOF
741
912
  done
742
913
 
743
914
  mkdir -p .planning/scripts
744
- script_source="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
745
915
  for script in "$script_source"/*.sh; do
746
916
  cp "$script" ".planning/scripts/$(basename "$script")"
747
917
  chmod +x ".planning/scripts/$(basename "$script")"
748
918
  done
749
919
 
920
+ GH_PROJECT_WHAT="$project_title" \
921
+ GH_PROJECT_USERS="$project_users" \
922
+ GH_PROJECT_VALUE="$core_value" \
923
+ GH_PROJECT_SCOPE="$product_scope" \
924
+ GH_PROJECT_MILESTONE="$current_milestone" \
925
+ GH_PROJECT_SUCCESS="$success_criteria" \
926
+ perl -0pi -e 's/__PROJECT_WHAT__/$ENV{GH_PROJECT_WHAT}/g; s/__PROJECT_USERS__/$ENV{GH_PROJECT_USERS}/g; s/__PROJECT_VALUE__/$ENV{GH_PROJECT_VALUE}/g; s/__PROJECT_SCOPE__/$ENV{GH_PROJECT_SCOPE}/g; s/__PROJECT_MILESTONE__/$ENV{GH_PROJECT_MILESTONE}/g; s/__PROJECT_SUCCESS__/$ENV{GH_PROJECT_SUCCESS}/g' .planning/PROJECT.md
927
+
928
+ GH_FUNCTIONAL_REQUIREMENTS="$functional_requirements" \
929
+ GH_USER_STORIES="$user_stories" \
930
+ GH_ACCEPTANCE_CRITERIA="$acceptance_criteria" \
931
+ GH_KNOWN_UNKNOWNS="$known_unknowns" \
932
+ perl -0pi -e 's/- \[ \] TBD\n\n## Non-Functional Requirements/- [ ] TBD\n\n## Seeded From User Idea\n\n$ENV{GH_FUNCTIONAL_REQUIREMENTS}\n\n## Non-Functional Requirements/s; s/- \[ \] As a user, I want TBD so that TBD\./$ENV{GH_USER_STORIES}/g; s/## Acceptance Criteria\n\n- \[ \] TBD/## Acceptance Criteria\n\n$ENV{GH_ACCEPTANCE_CRITERIA}/s; s/## Known Unknowns\n\n- \[ \] TBD/## Known Unknowns\n\n$ENV{GH_KNOWN_UNKNOWNS}/s' .planning/REQUIREMENTS.md
933
+
934
+ GH_STACK_DIRECTION="$stack_direction" \
935
+ GH_STACK_HINT="$stack_hint" \
936
+ GH_STACK_CLUES="$detected_stack" \
937
+ perl -0pi -e 's/Version constraints: TBD/Version constraints: TBD\n\n## Product Direction Clues\n- $ENV{GH_STACK_DIRECTION}\n- $ENV{GH_STACK_HINT}\n\n## Repository Stack Clues\n$ENV{GH_STACK_CLUES}/s' .planning/STACK.md
938
+
939
+ GH_SUMMARY_FOCUS="$summary_focus" \
940
+ GH_SUMMARY_RECENT="$summary_recent" \
941
+ GH_SUMMARY_NEXT="$summary_next" \
942
+ perl -0pi -e 's/- \[ \] Initialize harness and complete discovery \/ QA alignment\./$ENV{GH_SUMMARY_FOCUS}/g; s/- \[ \] Initial planning skeleton and discovery phase created\./$ENV{GH_SUMMARY_RECENT}/g; s/- \[ \] Answer INIT_QA\.md and complete Phase 01 discovery artifacts\./$ENV{GH_SUMMARY_NEXT}/g' .planning/SUMMARY.md
943
+
944
+ GH_IDEA_SUMMARY="$idea_summary" \
945
+ perl -0pi -e 's/Complete this immediately after `\/init`\./Complete this immediately after `\/init`.\n\n## Original User Brief\n\n- [ ] $ENV{GH_IDEA_SUMMARY}\n/s' .planning/INIT_QA.md
946
+
947
+ write_if_missing .codebase/CURRENT_STATE.md <<EOF
948
+ # Current System State
949
+
950
+ **Time**: $current_day_local
951
+ **Status**: \`IN_PROGRESS\`
952
+ **Latest Session**: \`$current_day_local-auto-init-bootstrap\`
953
+
954
+ ## Active Bootstrap
955
+
956
+ - Planning harness initialized automatically from the first user brief.
957
+ - Current planner phase: \`REQUIREMENTS_GATHERING\`
958
+ - User brief: $idea_summary
959
+ - Next task: Answer \`.planning/INIT_QA.md\` and confirm product approach, QA closure, and tech stack.
960
+ EOF
961
+
962
+ write_if_missing .codebase/state.json <<EOF
963
+ {
964
+ "current_state": "REQUIREMENTS_GATHERING",
965
+ "active_work": "Auto-init from user idea",
966
+ "session_id": "$current_day_local-auto-init-bootstrap",
967
+ "session_started_at": "$current_iso_utc",
968
+ "latest_recovery_point": "Auto-init bootstrap in progress",
969
+ "required_verification": [
970
+ "genesis-harness init --yes --platform codex --idea '<user brief>'",
971
+ "Answer .planning/INIT_QA.md",
972
+ "Update .planning/PROJECT.md, REQUIREMENTS.md, STACK.md"
973
+ ],
974
+ "pending_tasks": [
975
+ "Confirm product approach",
976
+ "Confirm QA sign-off owner",
977
+ "Confirm tech stack"
978
+ ]
979
+ }
980
+ EOF
981
+
750
982
  echo "Project Genesis Harness planning files initialized."
@@ -72,7 +72,10 @@ If visual output fails, capture screenshot evidence, update the fixture or contr
72
72
  5. Verify the result:
73
73
  - Run the project checks that prove the UI compiles.
74
74
  - Start the local dev server when needed.
75
- - Capture screenshots for visual work and inspect desktop/mobile layouts for overlap, clipping, unreadable text, blank canvases, and broken assets.
75
+ - **Automated Visual Verification Loop**:
76
+ 1. Use the `@modelcontextprotocol/server-puppeteer` tool to automatically navigate to the local dev server (e.g., `http://localhost:3000`) and capture a screenshot of the current UI.
77
+ 2. **Target Matching**: Use your Vision capabilities to compare your screenshot against `mockup.png`. Iterate and update the code until the UI matches 100%.
78
+ 3. **Aesthetic Audit**: Analyze your screenshot for aesthetic flaws (alignment, spacing, typography, bad AI-generated slop, inconsistent styles) and autonomously update the code to fix them. Repeat the screenshot capture until the UI looks premium.
76
79
 
77
80
  ## Design Rules
78
81
 
@@ -2,3 +2,5 @@ interface:
2
2
  display_name: "Genesis New Design"
3
3
  short_description: "— Thiết kế giao diện Web hiện đại, cao cấp"
4
4
  default_prompt: "Use $genesis-new-design to design and build a premium frontend web experience."
5
+ policy:
6
+ allow_implicit_invocation: true