codex-genesis-harness 0.1.4 → 0.1.5
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.
- package/.codebase/CURRENT_STATE.md +4 -7
- package/.codebase/state.json +37 -0
- package/.codex/skills/genesis-harness/SKILL.md +11 -2
- package/.codex/skills/genesis-state-machine/SKILL.md +34 -0
- package/.codex-plugin/plugin.json +6 -6
- package/README.EN.md +20 -9
- package/README.VI.md +16 -5
- package/README.md +19 -14
- package/VERSION +1 -1
- package/package.json +62 -43
- package/scripts/transition_state.sh +67 -0
- package/scripts/validation_gates.sh +46 -0
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
# Current State
|
|
2
|
-
|
|
3
|
-
Current objective: evolve `codex-genesis-harness` into a reusable Genesis skill set for test-first, contract-first, memory-aware Codex workflows.
|
|
4
|
-
|
|
5
|
-
**Current Status**: 100% Complete & Verified! All 24 skills are implemented, structural and smoke tests pass (`verify.sh`), and package integration & regression e2e checks pass cleanly (`run-evals.sh`). Ready for release.
|
|
6
|
-
|
|
7
|
-
Start every task by reading this file, `MODULE_INDEX.md`, and `TEST_MATRIX.md`, then inspect only relevant files.
|
|
1
|
+
# Current State: COMPLETED
|
|
2
|
+
Last updated: Sun May 31 12:53:47 +07 2026
|
|
8
3
|
|
|
4
|
+
## Reason
|
|
5
|
+
testing complete transition
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
{
|
|
2
|
+
"current_state": "COMPLETED",
|
|
3
|
+
"history": [
|
|
4
|
+
{
|
|
5
|
+
"from": "INIT",
|
|
6
|
+
"to": "REQUIREMENTS_GATHERING",
|
|
7
|
+
"reason": "Started Gathering",
|
|
8
|
+
"timestamp": "2026-05-31T05:39:53.706Z"
|
|
9
|
+
},
|
|
10
|
+
{
|
|
11
|
+
"from": "REQUIREMENTS_GATHERING",
|
|
12
|
+
"to": "PLANNING",
|
|
13
|
+
"reason": "p",
|
|
14
|
+
"timestamp": "2026-05-31T05:51:07.765Z"
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
"from": "PLANNING",
|
|
18
|
+
"to": "IMPLEMENTATION",
|
|
19
|
+
"reason": "i",
|
|
20
|
+
"timestamp": "2026-05-31T05:51:07.883Z"
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
"from": "IMPLEMENTATION",
|
|
24
|
+
"to": "VERIFICATION",
|
|
25
|
+
"reason": "v",
|
|
26
|
+
"timestamp": "2026-05-31T05:51:08.001Z"
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
"from": "VERIFICATION",
|
|
30
|
+
"to": "COMPLETED",
|
|
31
|
+
"reason": "testing complete transition",
|
|
32
|
+
"timestamp": "2026-05-31T05:53:47.517Z"
|
|
33
|
+
}
|
|
34
|
+
],
|
|
35
|
+
"context": {},
|
|
36
|
+
"pending_tasks": []
|
|
37
|
+
}
|
|
@@ -19,7 +19,7 @@ Use for project initialization, planning, feature work, bug fixes, audits, revie
|
|
|
19
19
|
Do not use for simple read-only answers that do not require repository workflow or durable artifacts.
|
|
20
20
|
|
|
21
21
|
## Inputs required
|
|
22
|
-
Read `.codebase/CURRENT_STATE.md`, `.codebase/MODULE_INDEX.md`, and `.codebase/TEST_MATRIX.md` when present, then inspect only relevant files.
|
|
22
|
+
Read `.codebase/state.json` (MANDATORY on boot), `.codebase/CURRENT_STATE.md`, `.codebase/MODULE_INDEX.md`, and `.codebase/TEST_MATRIX.md` when present, then inspect only relevant files.
|
|
23
23
|
|
|
24
24
|
## Outputs required
|
|
25
25
|
Plan or implementation artifact, tests, fixtures, verification evidence, docs sync, and codebase memory updates.
|
|
@@ -46,7 +46,7 @@ Work is complete only when tests pass, contracts and docs are current, and verif
|
|
|
46
46
|
Implementing before tests, skipping fixtures, overloading `AGENTS.md`, and duplicating long context across skills.
|
|
47
47
|
|
|
48
48
|
## Recovery workflow
|
|
49
|
-
If blocked or interrupted,
|
|
49
|
+
If blocked or interrupted, read `.codebase/state.json` to identify your exact FSM state. Rerun verification, identify the first failing phase, and resume from that point based on the strict state rules.
|
|
50
50
|
|
|
51
51
|
## Core Principle
|
|
52
52
|
|
|
@@ -178,6 +178,7 @@ Bundled scripts live under `scripts/`. Prefer copying or adapting these into `.p
|
|
|
178
178
|
- `create-bug.sh`: scaffolds `.planning/bugs/NNN-bug-slug/`.
|
|
179
179
|
- `create-adr.sh`: scaffolds `.planning/decisions/ADR-NNN-slug.md`.
|
|
180
180
|
- `update-state.sh`: updates common fields in `.planning/STATE.md`.
|
|
181
|
+
- **NEW**: `transition_state.sh`: Strict FSM transition script. You MUST use this script to move between `INIT`, `REQUIREMENTS_GATHERING`, `PLANNING`, `IMPLEMENTATION`, `VERIFICATION`, and `COMPLETED` states.
|
|
181
182
|
- `offload-log.sh`: captures and trims large command outputs to protect the context window.
|
|
182
183
|
- `compact-context.sh`: intelligent context compaction summarizing state to disk.
|
|
183
184
|
- `run-verify-loop.sh`: state-tracked Ralph Loop verify-fix loop executor.
|
|
@@ -371,6 +372,14 @@ Feature, bug, phase, audit, and architecture work is ready to implement only whe
|
|
|
371
372
|
|
|
372
373
|
If any item is false, do not implement. Update tracking to `[!]` or ask the user.
|
|
373
374
|
|
|
375
|
+
## Validation Gates
|
|
376
|
+
|
|
377
|
+
Before moving to the `COMPLETED` state, the agent MUST pass the validation gates:
|
|
378
|
+
- Run `bash scripts/validation_gates.sh`
|
|
379
|
+
- Ensure no leftover `TODO`, `FIXME`, `console.log`, or `print` statements remain in production code.
|
|
380
|
+
- Ensure all tests and `verify.sh` checks pass.
|
|
381
|
+
- If the validation gates fail, the agent is forced to remain in `VERIFICATION` or return to `IMPLEMENTATION` to fix the issues.
|
|
382
|
+
|
|
374
383
|
## Definition Of Done
|
|
375
384
|
|
|
376
385
|
Work is done only when:
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: genesis-state-machine
|
|
3
|
+
description: Formal Finite State Machine for memory, context persistence, and validation gates.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Genesis State Machine (FSM)
|
|
7
|
+
|
|
8
|
+
This skill dictates how the Agent tracks, persists, and transitions its internal state to survive session interruptions and enforce strict execution gates.
|
|
9
|
+
|
|
10
|
+
## Core States
|
|
11
|
+
|
|
12
|
+
The Genesis Harness operates in the following strict states:
|
|
13
|
+
|
|
14
|
+
1. `INIT`: The agent has just booted. Needs to gather user intent or resume a previous task.
|
|
15
|
+
2. `REQUIREMENTS_GATHERING`: Clarifying the user's request, doing empirical research.
|
|
16
|
+
3. `PLANNING`: Creating `implementation_plan.md` and writing tests.
|
|
17
|
+
4. `IMPLEMENTATION`: Writing code to satisfy tests and plan.
|
|
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.
|
|
20
|
+
|
|
21
|
+
## Rules of State Transition
|
|
22
|
+
|
|
23
|
+
- **NEVER** skip a state directly (e.g., from `REQUIREMENTS_GATHERING` to `IMPLEMENTATION` without `PLANNING`).
|
|
24
|
+
- **ALWAYS** use the strict transition script to change states: `bash scripts/transition_state.sh <NEW_STATE> "Reason for transition"`
|
|
25
|
+
- **ALWAYS** read `.codebase/state.json` when you start a new conversation or wake up, to know exactly where you left off.
|
|
26
|
+
|
|
27
|
+
## Handling Interruptions
|
|
28
|
+
If the user's connection drops or you are restarted:
|
|
29
|
+
1. Read `.codebase/state.json`
|
|
30
|
+
2. If `current_state` is `IMPLEMENTATION`, resume coding based on the `task.md`.
|
|
31
|
+
3. If `current_state` is `VERIFICATION`, resume running test scripts.
|
|
32
|
+
|
|
33
|
+
## The State File
|
|
34
|
+
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.
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
2
|
"name": "genesis-skill-set",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.5",
|
|
4
4
|
"description": "Genesis harness skill system for Codex test-first, contract-first, memory-aware autonomous workflows.",
|
|
5
|
-
"author": {
|
|
5
|
+
"author": {
|
|
6
6
|
"name": "Genesis Skill Set"
|
|
7
|
-
},
|
|
8
|
-
"license": "MIT",
|
|
9
|
-
"keywords": [
|
|
7
|
+
},
|
|
8
|
+
"license": "MIT",
|
|
9
|
+
"keywords": [
|
|
10
10
|
"codex",
|
|
11
11
|
"skill",
|
|
12
12
|
"planning",
|
package/README.EN.md
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
## 📌 What is Genesis Codex Harness?
|
|
8
8
|
|
|
9
|
-
**Genesis Codex Harness** is an enterprise-grade, **Codex-exclusive** development framework for building production-quality software with Codex
|
|
9
|
+
**Genesis Codex Harness** is an enterprise-grade, **Codex-exclusive** development framework for building production-quality software with Codex as your AI engineer.
|
|
10
10
|
|
|
11
11
|
### Core Capabilities
|
|
12
12
|
|
|
@@ -546,14 +546,14 @@ Genesis:
|
|
|
546
546
|
|
|
547
547
|
---
|
|
548
548
|
|
|
549
|
-
## 📚
|
|
549
|
+
## 📚 24 Skills (All Available)
|
|
550
550
|
|
|
551
|
-
Each skill follows
|
|
551
|
+
Each skill follows the standard naming convention in `.codex/skills/`:
|
|
552
552
|
|
|
553
553
|
| Skill Directory | Purpose | When to Use |
|
|
554
554
|
|---|---|---|
|
|
555
|
-
| **genesis-harness** | Main
|
|
556
|
-
| **genesis-research-first** | Autonomous empirical research before
|
|
555
|
+
| **genesis-harness** | Main entry point of the system | `/genesis-init`, `/new-feature`, `/fix-bug` |
|
|
556
|
+
| **genesis-research-first** | Autonomous empirical research before planning | Triggers automatically on new tasks |
|
|
557
557
|
| **genesis-api-contract** | Design robust API contracts (schema, request, response) | Before implementing endpoints |
|
|
558
558
|
| **genesis-api-sync** | Automate bi-directional contract & codebase synchronization | When endpoints are updated |
|
|
559
559
|
| **genesis-spec-propagation** | Automatically cascade design specification updates downstream | When specs change |
|
|
@@ -599,7 +599,7 @@ Each skill follows standardized naming under the `.codex/skills/` directory:
|
|
|
599
599
|
A: No! Genesis handles most Codex interactions. You mainly use simple commands like `/genesis-init`, `/new-feature`, etc.
|
|
600
600
|
|
|
601
601
|
**Q: Is Genesis Codex-exclusive or can I use it with other models?**
|
|
602
|
-
A: **Codex-exclusive only**. Genesis is specifically designed for
|
|
602
|
+
A: **Codex-exclusive only**. Genesis is specifically designed for Codex strengths. Using other models will break the workflow.
|
|
603
603
|
|
|
604
604
|
**Q: How much can I actually save on tokens?**
|
|
605
605
|
A: Typically **40-60% per project**. Average project: 150k tokens (normal) → 60-90k tokens (with Genesis caching).
|
|
@@ -620,7 +620,7 @@ A: Main limits are technical: max 5 phases per project (performance), token budg
|
|
|
620
620
|
### Requirements
|
|
621
621
|
- Node.js 16+
|
|
622
622
|
- npm 8+
|
|
623
|
-
- Codex
|
|
623
|
+
- Codex via VS Code Copilot
|
|
624
624
|
|
|
625
625
|
### Install Methods
|
|
626
626
|
|
|
@@ -632,7 +632,7 @@ genesis-harness verify
|
|
|
632
632
|
|
|
633
633
|
**Method 2: From Git**
|
|
634
634
|
```bash
|
|
635
|
-
git clone https://github.com/
|
|
635
|
+
git clone https://github.com/tuanpham09/codex-genesis-harness.git
|
|
636
636
|
cd codex-genesis-harness
|
|
637
637
|
./scripts/install.sh
|
|
638
638
|
./scripts/verify.sh
|
|
@@ -684,9 +684,20 @@ npm run pack:check # Check npm package
|
|
|
684
684
|
|
|
685
685
|
---
|
|
686
686
|
|
|
687
|
+
## 💖 Support the Project (Donate)
|
|
688
|
+
|
|
689
|
+
This project is open-source and developed with passion. If you find **Genesis Codex Harness** helpful and it saves you time, consider buying me a coffee to keep the momentum going:
|
|
690
|
+
|
|
691
|
+
- **Momo (Vietnam)**: `0865814259`
|
|
692
|
+
- **PayPal**: *(Will be updated later)*
|
|
693
|
+
|
|
694
|
+
Thank you so much for supporting the development of this project! ❤️
|
|
695
|
+
|
|
696
|
+
---
|
|
697
|
+
|
|
687
698
|
## 🔗 Resources
|
|
688
699
|
|
|
689
|
-
- **GitHub**: [codex-genesis-harness](https://github.com/
|
|
700
|
+
- **GitHub**: [codex-genesis-harness](https://github.com/tuanpham09/codex-genesis-harness)
|
|
690
701
|
- **Documentation**: See [.codex/](./codex/) folder
|
|
691
702
|
- **Issues**: GitHub Issues
|
|
692
703
|
- **Discussions**: GitHub Discussions
|
package/README.VI.md
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
## 📌 Genesis Codex Harness Là Gì?
|
|
8
8
|
|
|
9
|
-
**Genesis Codex Harness** là một bộ framework phát triển phần mềm cấp enterprise, **chỉ dành cho Codex
|
|
9
|
+
**Genesis Codex Harness** là một bộ framework phát triển phần mềm cấp enterprise, **chỉ dành cho Codex**, giúp bạn xây dựng phần mềm chất lượng cao một cách có quy trình và hiệu quả.
|
|
10
10
|
|
|
11
11
|
### Các Khả Năng Chính
|
|
12
12
|
|
|
@@ -598,7 +598,7 @@ Mỗi skill tuân theo naming quy chuẩn trong thư mục `.codex/skills/`:
|
|
|
598
598
|
A: Không! Genesis xử lý hầu hết. Bạn chỉ dùng commands đơn giản như `/genesis-init`, `/new-feature`.
|
|
599
599
|
|
|
600
600
|
**Q: Genesis có dành cho mô hình AI khác không?**
|
|
601
|
-
A: **Chỉ dành cho Codex
|
|
601
|
+
A: **Chỉ dành cho Codex**. Genesis được thiết kế riêng cho Codex.
|
|
602
602
|
|
|
603
603
|
**Q: Tiết kiệm token bao nhiêu thực tế?**
|
|
604
604
|
A: **40-60% per project**. Dự án bình thường: 150k tokens → 60-90k tokens (với Genesis).
|
|
@@ -619,7 +619,7 @@ A: Main limits: max 5 giai đoạn/project, token budget enforcement.
|
|
|
619
619
|
### Yêu Cầu
|
|
620
620
|
- Node.js 16+
|
|
621
621
|
- npm 8+
|
|
622
|
-
- Codex
|
|
622
|
+
- Codex qua VS Code Copilot
|
|
623
623
|
|
|
624
624
|
### Cách Cài
|
|
625
625
|
|
|
@@ -631,7 +631,7 @@ genesis-harness verify
|
|
|
631
631
|
|
|
632
632
|
**Cách 2: Từ Git**
|
|
633
633
|
```bash
|
|
634
|
-
git clone https://github.com/
|
|
634
|
+
git clone https://github.com/tuanpham09/codex-genesis-harness.git
|
|
635
635
|
cd codex-genesis-harness
|
|
636
636
|
./scripts/install.sh
|
|
637
637
|
./scripts/verify.sh
|
|
@@ -677,9 +677,20 @@ npm run eval # Chạy evaluation
|
|
|
677
677
|
|
|
678
678
|
---
|
|
679
679
|
|
|
680
|
+
## 💖 Ủng Hộ Dự Án (Donate)
|
|
681
|
+
|
|
682
|
+
Dự án này là mã nguồn mở và được phát triển hoàn toàn vì đam mê. Nếu bạn thấy **Genesis Codex Harness** hữu ích và giúp bạn tiết kiệm thời gian, bạn có thể mời tôi một ly cafe để tiếp thêm động lực phát triển nhé:
|
|
683
|
+
|
|
684
|
+
- **Momo**: `0865814259`
|
|
685
|
+
- **PayPal**: *(Sẽ cập nhật sau)*
|
|
686
|
+
|
|
687
|
+
Cảm ơn bạn rất nhiều vì đã đồng hành cùng sự phát triển của dự án! ❤️
|
|
688
|
+
|
|
689
|
+
---
|
|
690
|
+
|
|
680
691
|
## 🔗 Tài Nguyên
|
|
681
692
|
|
|
682
|
-
- **GitHub**: [codex-genesis-harness](https://github.com/
|
|
693
|
+
- **GitHub**: [codex-genesis-harness](https://github.com/tuanpham09/codex-genesis-harness)
|
|
683
694
|
- **Tài Liệu**: Xem thư mục [.codex/](./codex/)
|
|
684
695
|
- **Issues**: GitHub Issues
|
|
685
696
|
- **Thảo Luận**: GitHub Discussions
|
package/README.md
CHANGED
|
@@ -1,23 +1,28 @@
|
|
|
1
|
-
# Genesis Codex Harness |
|
|
1
|
+
# 🚀 Genesis Codex Harness | The Ultimate Enterprise SDLC Harness for Codex
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
[](https://www.npmjs.com/package/codex-genesis-harness)
|
|
4
|
+
[](LICENSE)
|
|
5
|
+
[](#)
|
|
6
|
+
[](#)
|
|
7
|
+
[](#)
|
|
8
|
+
|
|
9
|
+
**Genesis Codex Harness** is an enterprise-grade, Codex-exclusive software development lifecycle (SDLC) framework. It converts Codex from a simple autocomplete assistant into a rigorous, autonomous AI Software Engineer that enforces strict test-first development, contract-first design, and persistent codebase memory.
|
|
10
|
+
|
|
11
|
+
> [!NOTE]
|
|
12
|
+
> Engineered to eliminate the #1 frustration of AI-assisted development—**context decay, token exhaustion, and silent regression**—while slashing API token overhead by **40% to 60%** per project.
|
|
6
13
|
|
|
7
14
|
---
|
|
8
15
|
|
|
9
|
-
## ⚡
|
|
16
|
+
## ⚡ Core Pillars at a Glance
|
|
10
17
|
|
|
11
|
-
**
|
|
18
|
+
* 🛑 **The Death of Context Rot:** Automatically offloads massive terminal outputs (`offload-log.sh`) and dynamically compacts codebase state (`compact-context.sh`). Your prompt stays clean and sharp even after 100+ continuous development turns.
|
|
19
|
+
* 🔥 **Autonomous Self-Healing (Ralph Loops):** Caught a test failure or compiler crash? The harness executes closed-loop **Verify-Fix cycles** (`run-verify-loop.sh`) up to 5 times autonomously, reading errors and refactoring source code until the tests turn green.
|
|
20
|
+
* 🧠 **Empirical, Research-First Engineering:** Enforces evidence-based solutions. Genesis runs automated scans of your local codebase patterns and official package repositories *before* writing a single line of plans or implementation code.
|
|
21
|
+
* 🔄 **Cascading Spec Propagation:** Change a single schema field or API contract and watch the harness automatically cascade modifications (`/propagate-spec`) across all downstream phases, test fixtures, and integration assertions.
|
|
12
22
|
|
|
13
|
-
|
|
14
|
-
- ✅ **Contract-first API design** (before coding)
|
|
15
|
-
- ✅ **Persistent project memory** (no re-explaining needed)
|
|
16
|
-
- ✅ **40-60% token savings** (via smart caching)
|
|
17
|
-
- ✅ **Automatic spec propagation** (changes cascade through phases)
|
|
18
|
-
- ✅ **Multi-phase orchestration** (5 phases per project)
|
|
23
|
+
---
|
|
19
24
|
|
|
20
|
-
|
|
25
|
+
## 🎯 Perfect For
|
|
21
26
|
- Enterprise teams building complex software with Codex
|
|
22
27
|
- Projects requiring reliable, repeatable workflows
|
|
23
28
|
- Organizations wanting to reduce token costs
|
|
@@ -188,7 +193,7 @@ Learn more: [FILE_NAMING_CLARIFICATION.md](.codebase/FILE_NAMING_CLARIFICATION.m
|
|
|
188
193
|
### Requirements
|
|
189
194
|
- Node.js 16+
|
|
190
195
|
- npm 8+
|
|
191
|
-
- Codex
|
|
196
|
+
- Codex
|
|
192
197
|
|
|
193
198
|
### Quick Install
|
|
194
199
|
```bash
|
package/VERSION
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
0.1.
|
|
1
|
+
0.1.5
|
|
2
2
|
|
package/package.json
CHANGED
|
@@ -1,43 +1,62 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "codex-genesis-harness",
|
|
3
|
-
"version": "0.1.
|
|
4
|
-
"description": "
|
|
5
|
-
"license": "MIT",
|
|
6
|
-
"bin": {
|
|
7
|
-
"genesis-harness": "bin/genesis-harness.js"
|
|
8
|
-
},
|
|
9
|
-
"scripts": {
|
|
10
|
-
"postinstall": "node bin/genesis-harness.js postinstall",
|
|
11
|
-
"verify": "bash scripts/verify.sh",
|
|
12
|
-
"eval": "bash scripts/run-evals.sh",
|
|
13
|
-
"pack:check": "npm pack --dry-run"
|
|
14
|
-
},
|
|
15
|
-
"files": [
|
|
16
|
-
".codex-plugin",
|
|
17
|
-
".codex/skills",
|
|
18
|
-
".codebase",
|
|
19
|
-
"contracts",
|
|
20
|
-
"fixtures",
|
|
21
|
-
"tests",
|
|
22
|
-
"playwright",
|
|
23
|
-
"observability",
|
|
24
|
-
"bin",
|
|
25
|
-
"scripts",
|
|
26
|
-
"README.md",
|
|
27
|
-
"LICENSE",
|
|
28
|
-
"VERSION"
|
|
29
|
-
],
|
|
30
|
-
"keywords": [
|
|
31
|
-
"codex",
|
|
32
|
-
"
|
|
33
|
-
"
|
|
34
|
-
"
|
|
35
|
-
"
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
"
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
"
|
|
42
|
-
|
|
43
|
-
|
|
1
|
+
{
|
|
2
|
+
"name": "codex-genesis-harness",
|
|
3
|
+
"version": "0.1.5",
|
|
4
|
+
"description": "Hệ thống quản trị (Harness) dành cho AI Agent (Codex) với cơ chế FSM State Persistence, Validation Gates và Test-First Workflow. Đảm bảo agent không bị trôi context.",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"bin": {
|
|
7
|
+
"genesis-harness": "bin/genesis-harness.js"
|
|
8
|
+
},
|
|
9
|
+
"scripts": {
|
|
10
|
+
"postinstall": "node bin/genesis-harness.js postinstall",
|
|
11
|
+
"verify": "bash scripts/verify.sh",
|
|
12
|
+
"eval": "bash scripts/run-evals.sh",
|
|
13
|
+
"pack:check": "npm pack --dry-run"
|
|
14
|
+
},
|
|
15
|
+
"files": [
|
|
16
|
+
".codex-plugin",
|
|
17
|
+
".codex/skills",
|
|
18
|
+
".codebase",
|
|
19
|
+
"contracts",
|
|
20
|
+
"fixtures",
|
|
21
|
+
"tests",
|
|
22
|
+
"playwright",
|
|
23
|
+
"observability",
|
|
24
|
+
"bin",
|
|
25
|
+
"scripts",
|
|
26
|
+
"README.md",
|
|
27
|
+
"LICENSE",
|
|
28
|
+
"VERSION"
|
|
29
|
+
],
|
|
30
|
+
"keywords": [
|
|
31
|
+
"codex",
|
|
32
|
+
"ai-agent",
|
|
33
|
+
"autonomous-agent",
|
|
34
|
+
"harness-engineering",
|
|
35
|
+
"llm-workflow",
|
|
36
|
+
"project-management",
|
|
37
|
+
"state-machine",
|
|
38
|
+
"fsm",
|
|
39
|
+
"codex-plugin",
|
|
40
|
+
"developer-tools",
|
|
41
|
+
"validation-gates"
|
|
42
|
+
],
|
|
43
|
+
"engines": {
|
|
44
|
+
"node": ">=18"
|
|
45
|
+
},
|
|
46
|
+
"publishConfig": {
|
|
47
|
+
"access": "public"
|
|
48
|
+
},
|
|
49
|
+
"author": "Genesis Codex Team",
|
|
50
|
+
"repository": {
|
|
51
|
+
"type": "git",
|
|
52
|
+
"url": "git+https://github.com/tuanpham09/codex-genesis-harness.git"
|
|
53
|
+
},
|
|
54
|
+
"bugs": {
|
|
55
|
+
"url": "https://github.com/tuanpham09/codex-genesis-harness/issues"
|
|
56
|
+
},
|
|
57
|
+
"homepage": "https://github.com/tuanpham09/codex-genesis-harness#readme",
|
|
58
|
+
"funding": {
|
|
59
|
+
"type": "momo",
|
|
60
|
+
"url": "tel:0865814259"
|
|
61
|
+
}
|
|
62
|
+
}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
|
|
3
|
+
if [ -z "$1" ]; then
|
|
4
|
+
echo "Usage: bash scripts/transition_state.sh <NEW_STATE> [Reason]"
|
|
5
|
+
exit 1
|
|
6
|
+
fi
|
|
7
|
+
|
|
8
|
+
NEW_STATE=$1
|
|
9
|
+
REASON=${2:-"State transition"}
|
|
10
|
+
STATE_FILE=".codebase/state.json"
|
|
11
|
+
CURRENT_STATE_MD=".codebase/CURRENT_STATE.md"
|
|
12
|
+
|
|
13
|
+
if [ ! -f "$STATE_FILE" ]; then
|
|
14
|
+
echo "Error: $STATE_FILE not found."
|
|
15
|
+
exit 1
|
|
16
|
+
fi
|
|
17
|
+
|
|
18
|
+
if [ "$NEW_STATE" == "COMPLETED" ]; then
|
|
19
|
+
if [ -f "scripts/validation_gates.sh" ]; then
|
|
20
|
+
echo "Running Validation Gates before transitioning to COMPLETED..."
|
|
21
|
+
if ! bash scripts/validation_gates.sh; then
|
|
22
|
+
echo "Transition blocked by Validation Gates."
|
|
23
|
+
exit 1
|
|
24
|
+
fi
|
|
25
|
+
fi
|
|
26
|
+
fi
|
|
27
|
+
|
|
28
|
+
node -e "
|
|
29
|
+
const fs = require('fs');
|
|
30
|
+
const file = '$STATE_FILE';
|
|
31
|
+
const newState = '$NEW_STATE';
|
|
32
|
+
const reason = '$REASON';
|
|
33
|
+
|
|
34
|
+
const allowed = {
|
|
35
|
+
'INIT': ['REQUIREMENTS_GATHERING', 'PLANNING'],
|
|
36
|
+
'REQUIREMENTS_GATHERING': ['PLANNING'],
|
|
37
|
+
'PLANNING': ['IMPLEMENTATION'],
|
|
38
|
+
'IMPLEMENTATION': ['VERIFICATION', 'PLANNING'],
|
|
39
|
+
'VERIFICATION': ['COMPLETED', 'IMPLEMENTATION'],
|
|
40
|
+
'COMPLETED': ['INIT', 'REQUIREMENTS_GATHERING']
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
let data = JSON.parse(fs.readFileSync(file, 'utf8'));
|
|
44
|
+
const current = data.current_state || 'INIT';
|
|
45
|
+
|
|
46
|
+
if (allowed[current] && allowed[current].includes(newState)) {
|
|
47
|
+
data.history = data.history || [];
|
|
48
|
+
data.history.push({ from: current, to: newState, reason: reason, timestamp: new Date().toISOString() });
|
|
49
|
+
data.current_state = newState;
|
|
50
|
+
fs.writeFileSync(file, JSON.stringify(data, null, 2));
|
|
51
|
+
console.log('Transition successful: ' + current + ' -> ' + newState);
|
|
52
|
+
} else {
|
|
53
|
+
console.error('Invalid transition from ' + current + ' to ' + newState);
|
|
54
|
+
process.exit(1);
|
|
55
|
+
}
|
|
56
|
+
"
|
|
57
|
+
|
|
58
|
+
if [ $? -eq 0 ]; then
|
|
59
|
+
echo "# Current State: $NEW_STATE" > "$CURRENT_STATE_MD"
|
|
60
|
+
echo "Last updated: $(date)" >> "$CURRENT_STATE_MD"
|
|
61
|
+
echo "" >> "$CURRENT_STATE_MD"
|
|
62
|
+
echo "## Reason" >> "$CURRENT_STATE_MD"
|
|
63
|
+
echo "$REASON" >> "$CURRENT_STATE_MD"
|
|
64
|
+
exit 0
|
|
65
|
+
else
|
|
66
|
+
exit 1
|
|
67
|
+
fi
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
set -euo pipefail
|
|
3
|
+
|
|
4
|
+
echo "====================================="
|
|
5
|
+
echo " RUNNING VALIDATION GATES "
|
|
6
|
+
echo "====================================="
|
|
7
|
+
|
|
8
|
+
repo_root="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
|
9
|
+
FAILURES=0
|
|
10
|
+
|
|
11
|
+
fail() {
|
|
12
|
+
echo "❌ VALIDATION FAILED: $*" >&2
|
|
13
|
+
FAILURES=$((FAILURES + 1))
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
echo "1. Checking for leftover debug logs and TODOs..."
|
|
17
|
+
# Exclude node_modules, .git, .codex, scripts, .codebase, bin, and md files
|
|
18
|
+
EXCLUDES="--exclude-dir=node_modules --exclude-dir=.git --exclude-dir=.codex --exclude-dir=scripts --exclude-dir=.codebase --exclude-dir=bin --exclude=*.md"
|
|
19
|
+
|
|
20
|
+
# We check for TODO, FIXME, console.log, print( (python)
|
|
21
|
+
# Using grep recursively
|
|
22
|
+
if grep -rn $EXCLUDES -E 'TODO|FIXME|console\.log|print\(' "$repo_root" | grep -v 'validation_gates.sh'; then
|
|
23
|
+
fail "Found unresolved TODOs or leftover debug logs in codebase!"
|
|
24
|
+
else
|
|
25
|
+
echo "✅ Codebase cleanliness gate passed."
|
|
26
|
+
fi
|
|
27
|
+
|
|
28
|
+
echo "2. Verifying Harness Integrity..."
|
|
29
|
+
if [ -f "$repo_root/scripts/verify.sh" ]; then
|
|
30
|
+
if bash "$repo_root/scripts/verify.sh" > /dev/null 2>&1; then
|
|
31
|
+
echo "✅ Harness Integrity gate passed."
|
|
32
|
+
else
|
|
33
|
+
fail "verify.sh failed. Core files or templates are missing."
|
|
34
|
+
fi
|
|
35
|
+
else
|
|
36
|
+
fail "scripts/verify.sh is missing."
|
|
37
|
+
fi
|
|
38
|
+
|
|
39
|
+
echo "====================================="
|
|
40
|
+
if [ $FAILURES -gt 0 ]; then
|
|
41
|
+
echo "❌ $FAILURES Validation Gate(s) failed."
|
|
42
|
+
exit 1
|
|
43
|
+
else
|
|
44
|
+
echo "✅ All Validation Gates passed! Output is ready for production."
|
|
45
|
+
exit 0
|
|
46
|
+
fi
|