@leejungkiin/awkit 1.7.5 β 1.7.6
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/bin/awk.js +94 -0
- package/bin/codex-generators.js +2 -1
- package/core/GEMINI.md +2 -2
- package/core/skill-runtime-manifest.json +1 -0
- package/docs/history/implementation_plan.v1.md +49 -45
- package/docs/history/implementation_plan.v2.md +87 -0
- package/package.json +1 -1
- package/scripts/codex-goal.js +163 -0
- package/scripts/exec-rtk.js +4 -3
- package/skills/codex-goal/SKILL.md +82 -0
- package/workflows/lifecycle/goal.md +86 -0
package/bin/awk.js
CHANGED
|
@@ -2241,6 +2241,40 @@ function cmdGreet(args) {
|
|
|
2241
2241
|
}
|
|
2242
2242
|
}
|
|
2243
2243
|
|
|
2244
|
+
function cmdGoal(args) {
|
|
2245
|
+
if (args.includes('--help') || args.includes('-h')) {
|
|
2246
|
+
log('');
|
|
2247
|
+
log(`${C.cyan}${C.bold}π― awkit goal β Codex Goal Mode Orchestrator${C.reset}`);
|
|
2248
|
+
log('');
|
|
2249
|
+
log('Usage:');
|
|
2250
|
+
log(' awkit goal "<objective>"');
|
|
2251
|
+
log(' awkit goal --status');
|
|
2252
|
+
log(' awkit goal --pause');
|
|
2253
|
+
log(' awkit goal --resume');
|
|
2254
|
+
log(' awkit goal --cancel');
|
|
2255
|
+
log('');
|
|
2256
|
+
return;
|
|
2257
|
+
}
|
|
2258
|
+
|
|
2259
|
+
try {
|
|
2260
|
+
const scriptPath = path.join(__dirname, '..', 'scripts', 'codex-goal.js');
|
|
2261
|
+
const passArgs = [];
|
|
2262
|
+
|
|
2263
|
+
if (args.length > 0 && !args[0].startsWith('-')) {
|
|
2264
|
+
passArgs.push('--prompt', args.join(' '));
|
|
2265
|
+
} else {
|
|
2266
|
+
passArgs.push(...args);
|
|
2267
|
+
}
|
|
2268
|
+
|
|
2269
|
+
const result = spawnSync('node', [scriptPath, ...passArgs], { stdio: 'inherit' });
|
|
2270
|
+
if (result.status !== 0) {
|
|
2271
|
+
process.exit(result.status || 1);
|
|
2272
|
+
}
|
|
2273
|
+
} catch (e) {
|
|
2274
|
+
err('Failed to execute Codex Goal Mode: ' + e.message);
|
|
2275
|
+
}
|
|
2276
|
+
}
|
|
2277
|
+
|
|
2244
2278
|
function cmdHelp() {
|
|
2245
2279
|
const line = `${C.gray}${'β'.repeat(56)}${C.reset}`;
|
|
2246
2280
|
log('');
|
|
@@ -2339,6 +2373,16 @@ function cmdHelp() {
|
|
|
2339
2373
|
log(` ${C.gray} -t, --timezone <tz>${C.reset} Timezone parameter`);
|
|
2340
2374
|
log('');
|
|
2341
2375
|
|
|
2376
|
+
// Goal Mode
|
|
2377
|
+
log(`${C.bold}π― Goal Mode${C.reset}`);
|
|
2378
|
+
log(line);
|
|
2379
|
+
log(` ${C.green}goal${C.reset} <objective> Pursue a high-level goal using Codex Goal Conductor`);
|
|
2380
|
+
log(` ${C.green}goal --status${C.reset} Check active goal status and task progress`);
|
|
2381
|
+
log(` ${C.green}goal --pause${C.reset} Pause active goal execution loop`);
|
|
2382
|
+
log(` ${C.green}goal --resume${C.reset} Resume paused goal execution`);
|
|
2383
|
+
log(` ${C.green}goal --cancel${C.reset} Cancel and reset active goal session`);
|
|
2384
|
+
log('');
|
|
2385
|
+
|
|
2342
2386
|
// Symphony
|
|
2343
2387
|
log(`${C.bold}πΆ Symphony${C.reset}`);
|
|
2344
2388
|
log(line);
|
|
@@ -2774,6 +2818,16 @@ function buildProjectIdentity(projectName, projectType, cwd, date) {
|
|
|
2774
2818
|
automation: {
|
|
2775
2819
|
autoQA: true,
|
|
2776
2820
|
maxSelfCorrectionLoops: 3,
|
|
2821
|
+
multiAgent: {
|
|
2822
|
+
enabled: true,
|
|
2823
|
+
routingMode: 'cost-optimized',
|
|
2824
|
+
audioAlerts: true,
|
|
2825
|
+
runners: {
|
|
2826
|
+
claude: 'claude',
|
|
2827
|
+
codex: 'codex',
|
|
2828
|
+
qwen: 'qwen'
|
|
2829
|
+
}
|
|
2830
|
+
},
|
|
2777
2831
|
telegram: {
|
|
2778
2832
|
enabled: true,
|
|
2779
2833
|
chatId: "",
|
|
@@ -3021,6 +3075,16 @@ async function cmdInit(forceFlag = false) {
|
|
|
3021
3075
|
currentIdentity.automation = {
|
|
3022
3076
|
autoQA: true,
|
|
3023
3077
|
maxSelfCorrectionLoops: 3,
|
|
3078
|
+
multiAgent: {
|
|
3079
|
+
enabled: true,
|
|
3080
|
+
routingMode: 'cost-optimized',
|
|
3081
|
+
audioAlerts: true,
|
|
3082
|
+
runners: {
|
|
3083
|
+
claude: 'claude',
|
|
3084
|
+
codex: 'codex',
|
|
3085
|
+
qwen: 'qwen'
|
|
3086
|
+
}
|
|
3087
|
+
},
|
|
3024
3088
|
telegram: {
|
|
3025
3089
|
enabled: true,
|
|
3026
3090
|
chatId: "",
|
|
@@ -3061,6 +3125,33 @@ async function cmdInit(forceFlag = false) {
|
|
|
3061
3125
|
currentIdentity.automation.maxSelfCorrectionLoops = 3;
|
|
3062
3126
|
changed = true;
|
|
3063
3127
|
}
|
|
3128
|
+
if (!currentIdentity.automation.multiAgent) {
|
|
3129
|
+
currentIdentity.automation.multiAgent = {
|
|
3130
|
+
enabled: true,
|
|
3131
|
+
routingMode: 'cost-optimized',
|
|
3132
|
+
audioAlerts: true,
|
|
3133
|
+
runners: {
|
|
3134
|
+
claude: 'claude',
|
|
3135
|
+
codex: 'codex',
|
|
3136
|
+
qwen: 'qwen'
|
|
3137
|
+
}
|
|
3138
|
+
};
|
|
3139
|
+
changed = true;
|
|
3140
|
+
} else {
|
|
3141
|
+
if (!currentIdentity.automation.multiAgent.runners) {
|
|
3142
|
+
currentIdentity.automation.multiAgent.runners = {
|
|
3143
|
+
claude: 'claude',
|
|
3144
|
+
codex: 'codex',
|
|
3145
|
+
qwen: 'qwen'
|
|
3146
|
+
};
|
|
3147
|
+
changed = true;
|
|
3148
|
+
} else {
|
|
3149
|
+
const runners = currentIdentity.automation.multiAgent.runners;
|
|
3150
|
+
if (!runners.claude) { runners.claude = 'claude'; changed = true; }
|
|
3151
|
+
if (!runners.codex) { runners.codex = 'codex'; changed = true; }
|
|
3152
|
+
if (!runners.qwen) { runners.qwen = 'qwen'; changed = true; }
|
|
3153
|
+
}
|
|
3154
|
+
}
|
|
3064
3155
|
if (!currentIdentity.automation.obsidian) {
|
|
3065
3156
|
currentIdentity.automation.obsidian = { enabled: false, path: "", autoSync: false };
|
|
3066
3157
|
changed = true;
|
|
@@ -5150,6 +5241,9 @@ const [, , command, ...args] = process.argv;
|
|
|
5150
5241
|
case 'greet':
|
|
5151
5242
|
cmdGreet(args);
|
|
5152
5243
|
break;
|
|
5244
|
+
case 'goal':
|
|
5245
|
+
cmdGoal(args);
|
|
5246
|
+
break;
|
|
5153
5247
|
case 'config-global':
|
|
5154
5248
|
cmdGlobalConfig(args);
|
|
5155
5249
|
break;
|
package/bin/codex-generators.js
CHANGED
package/core/GEMINI.md
CHANGED
|
@@ -191,5 +191,5 @@ Complete>Shortcuts, Evidence>Assumptions, Standard>Custom, Explicit>Implicit, Te
|
|
|
191
191
|
- **Gate skills:** `orchestrator` (triage) β `brainstorm-agent` (G1) β `module-spec-writer` (G1.5) β `spec-gate` (G2) β `visual-design-gate` (G2.5) β `symphony-enforcer` (G3) β `verification-gate` (G5)
|
|
192
192
|
- **Code intelligence:** `gitnexus-intelligence` (impact analysis, blast radius, safe refactoring)
|
|
193
193
|
- **Skill catalog:** xem `orchestrator/SKILL.md`
|
|
194
|
-
- **Workflows:** 75+ (/xxx). Core: /init /code /debug /recap /next /todo /gitnexus /teach
|
|
195
|
-
- **Shortcuts:** `/todo` `/done` `/next`
|
|
194
|
+
- **Workflows:** 75+ (/xxx). Core: /init /code /debug /recap /next /todo /gitnexus /teach /goal
|
|
195
|
+
- **Shortcuts:** `/todo` `/done` `/next` `/goal`
|
|
@@ -1,58 +1,62 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Implementation Plan - GreetingApp Feature
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
> [!NOTE]
|
|
8
|
-
> All new skills will be created directly in `skills/` of `main-awf` workspace and then deployed to `~/.gemini/antigravity` via `awkit install`.
|
|
9
|
-
|
|
10
|
-
## Proposed Changes
|
|
11
|
-
|
|
12
|
-
### AWKit Skills
|
|
3
|
+
## Revision History
|
|
4
|
+
| Version | Date | Description | Author |
|
|
5
|
+
|---|---|---|---|
|
|
6
|
+
| v1.0 | 2026-06-22 | Initial implementation plan for GreetingApp | Antigravity Orchestrator |
|
|
13
7
|
|
|
14
8
|
---
|
|
15
9
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
-
|
|
19
|
-
-
|
|
20
|
-
-
|
|
21
|
-
-
|
|
22
|
-
- Direct Unity MCP server integration.
|
|
23
|
-
|
|
24
|
-
#### [NEW] [godot-game-development/SKILL.md](file:///Users/trungkientn/Dev/NodeJS/main-awf/skills/godot-game-development/SKILL.md)
|
|
25
|
-
Contains guidelines for Godot 4.x game development, enforcing:
|
|
26
|
-
- Godot 4 API standards (rejecting Godot 3 syntax).
|
|
27
|
-
- GDScript style preferences (`@export`, `@onready`, `await` signals).
|
|
28
|
-
- Composition-first scene tree structure over deep class inheritance.
|
|
29
|
-
- Signal connection best practices (`signal.connect(callback)`).
|
|
30
|
-
- Physics and locomotion handling via parameterless `move_and_slide()`.
|
|
31
|
-
|
|
32
|
-
#### [NEW] [expo-game-development/SKILL.md](file:///Users/trungkientn/Dev/NodeJS/main-awf/skills/expo-game-development/SKILL.md)
|
|
33
|
-
Contains instructions for Expo/React Native game development, covering:
|
|
34
|
-
- High-frequency drawing techniques (React Native Skia, Expo GL/Three.js).
|
|
35
|
-
- State optimization: keeping physics/game tick loop decoupled from heavy React re-renders.
|
|
36
|
-
- User input handling (React Native Gesture Handler).
|
|
37
|
-
- Game loop implementations using `requestAnimationFrame`.
|
|
38
|
-
- Asset management and sound effects via `expo-av`.
|
|
10
|
+
## 1. Objectives
|
|
11
|
+
Implement the GreetingApp feature within the `main-awf` workspace, integrating:
|
|
12
|
+
- A shared Greeting Engine at `core/GreetingEngine`.
|
|
13
|
+
- CLI Interface command `awkit greet` in `bin/awk.js`.
|
|
14
|
+
- REST API endpoint `GET /api/greet` in `symphony/app/api/greet/route.js`.
|
|
15
|
+
- Light history logging via JSON Lines at `~/.gemini/antigravity/greeting_history.jsonl` (and local project fallback).
|
|
39
16
|
|
|
40
17
|
---
|
|
41
18
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
####
|
|
46
|
-
|
|
19
|
+
## 2. Proposed Changes
|
|
20
|
+
|
|
21
|
+
### Phase A: Core Engine and Locales
|
|
22
|
+
#### 1. Locales Definition
|
|
23
|
+
Create locales JSON files under `core/GreetingEngine/locales/`:
|
|
24
|
+
- `en.json`: English templates.
|
|
25
|
+
- `vi.json`: Vietnamese templates.
|
|
26
|
+
- `ja.json`: Japanese templates.
|
|
27
|
+
|
|
28
|
+
#### 2. Greeting Engine (`core/GreetingEngine/index.js`)
|
|
29
|
+
Create the core processor. It will:
|
|
30
|
+
- Parse `name` (default: "Guest"), `lang` (default: "en"), and `timezone` (default: local).
|
|
31
|
+
- Determine time-of-day period (`morning` 5-11:59, `afternoon` 12-17:59, `evening` 18-21:59, `night` 22-4:59).
|
|
32
|
+
- Load localization strings, format the template by replacing `{name}`, and return the object.
|
|
33
|
+
- Record transactions to `greeting_history.jsonl`.
|
|
34
|
+
- Provide stats functions.
|
|
35
|
+
|
|
36
|
+
### Phase B: CLI Integration
|
|
37
|
+
#### 1. CLI Commands (`bin/awk.js`)
|
|
38
|
+
- Register the `greet` subcommand in the main switch-case.
|
|
39
|
+
- Parse flags: `--name` / `-n`, `--lang` / `-l`, and `--timezone` / `-t` (or use system timezone).
|
|
40
|
+
- Print the generated greeting and save to the history log.
|
|
41
|
+
|
|
42
|
+
### Phase C: REST API Integration
|
|
43
|
+
#### 1. API Route Handler (`symphony/app/api/greet/route.js`)
|
|
44
|
+
- Define `GET` handler.
|
|
45
|
+
- Extract `name`, `lang`, and `timezone` query parameters.
|
|
46
|
+
- Call the Greeting Engine.
|
|
47
|
+
- Return structured JSON response following spec.
|
|
47
48
|
|
|
48
49
|
---
|
|
49
50
|
|
|
50
|
-
## Verification Plan
|
|
51
|
+
## 3. Verification Plan
|
|
51
52
|
|
|
52
|
-
### Automated
|
|
53
|
-
-
|
|
54
|
-
-
|
|
55
|
-
- Verify
|
|
53
|
+
### Automated/Unit Tests
|
|
54
|
+
- Verify engine resolves times and timezones correctly.
|
|
55
|
+
- Verify fallback to `en` on unrecognized language inputs.
|
|
56
|
+
- Verify JSON structure matches specifications.
|
|
56
57
|
|
|
57
58
|
### Manual Verification
|
|
58
|
-
-
|
|
59
|
+
- Execute `node bin/awk.js greet --name="Alice" --lang="vi"`.
|
|
60
|
+
- Execute `node bin/awk.js greet --name="Bob" --lang="ja"`.
|
|
61
|
+
- Query Symphony REST API `/api/greet?name=Charlie&lang=en` locally.
|
|
62
|
+
- Inspect the history log at the designated path.
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
# Implementation Plan - Codex Goal Mode Integration
|
|
2
|
+
|
|
3
|
+
## Revision History
|
|
4
|
+
| Version | Date | Description | Author |
|
|
5
|
+
|---|---|---|---|
|
|
6
|
+
| v1.0 | 2026-06-22 | Initial plan for Codex Goal Mode, skill, and workflow integration | Antigravity Orchestrator |
|
|
7
|
+
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
## Goal Description
|
|
11
|
+
Implement a **Goal Mode** (including a new **Skill** and a **Workflow**) that utilizes the Codex goal-execution capabilities for centralized task orchestration. In this mode, Codex serves as the master coordinator (Goal Conductor), partitioning a high-level user goal into subtasks, tracking progress in Symphony, and delegating specific duties back to other specialized agents (Claude, Qwen, Gemini/AGY) or its own independent sub-agents (e.g., critic, coder, tester, ios-engineer) in a collaborative loop.
|
|
12
|
+
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
## User Review Required
|
|
16
|
+
|
|
17
|
+
> [!IMPORTANT]
|
|
18
|
+
> **Orchestration Loop Protocol:** Codex Goal Mode runs as a closed-loop execution system. Checkpoints are automatically bypassed when `goal_mode = true` (using best-effort AI verification) except for safety-critical, destructive, or security tasks.
|
|
19
|
+
|
|
20
|
+
---
|
|
21
|
+
|
|
22
|
+
## Open Questions
|
|
23
|
+
- Do we want to support persistent background session resume for long-running goals (e.g., using `codex resume --last`)? *(Currently planned to support resume by storing execution states in `codex-reports/goals/`).*
|
|
24
|
+
|
|
25
|
+
---
|
|
26
|
+
|
|
27
|
+
## Proposed Changes
|
|
28
|
+
|
|
29
|
+
### Core Orchestration Layer
|
|
30
|
+
|
|
31
|
+
#### [NEW] [codex-goal.js](file:///Users/trungkientn/Dev/NodeJS/main-awf/scripts/codex-goal.js)
|
|
32
|
+
Create a new script that coordinates the Goal loop:
|
|
33
|
+
1. Initializes a goal workspace under `codex-reports/goals/<goal_id>/`.
|
|
34
|
+
2. Sets `goal_mode = true` in the process context.
|
|
35
|
+
3. Invokes Codex CLI to analyze the initial goal, parse it into subtasks, and map them to appropriate agents.
|
|
36
|
+
4. Orchestrates task execution:
|
|
37
|
+
- For architecture & specs: Delegates to Claude via `scripts/claude-plan.js`.
|
|
38
|
+
- For coding/refactoring: Delegates to Qwen via `scripts/qwen-exec.js`.
|
|
39
|
+
- For general tasks/fallbacks: Delegates to AGY (Gemini).
|
|
40
|
+
- For reviews, tests, visual QA: Delegates to Codex sub-agents (`critic`, `tester`, `ios-visual-qa-strategist`).
|
|
41
|
+
5. Tracks states, saves progress reports to `.md` files, and updates Symphony tickets.
|
|
42
|
+
|
|
43
|
+
---
|
|
44
|
+
|
|
45
|
+
### Workflows
|
|
46
|
+
|
|
47
|
+
#### [NEW] [goal.md](file:///Users/trungkientn/Dev/NodeJS/main-awf/workflows/lifecycle/goal.md)
|
|
48
|
+
Define the `/goal` workflow containing:
|
|
49
|
+
- Pre-requisites checks for Codex CLI.
|
|
50
|
+
- Workflow subcommands: `/goal "[objective]"`, `/goal:status`, `/goal:resume`, `/goal:pause`, `/goal:cancel`.
|
|
51
|
+
- Detailed description of the autonomous goal execution loop.
|
|
52
|
+
- Fallback policies and recovery steps.
|
|
53
|
+
|
|
54
|
+
---
|
|
55
|
+
|
|
56
|
+
### Skills
|
|
57
|
+
|
|
58
|
+
#### [NEW] [SKILL.md](file:///Users/trungkientn/Dev/NodeJS/main-awf/skills/codex-goal/SKILL.md)
|
|
59
|
+
Create a new skill for the Codex Goal Orchestrator defining:
|
|
60
|
+
- Developer instructions for the master Goal Conductor role.
|
|
61
|
+
- Task breakdown schemas and JSON mapping format.
|
|
62
|
+
- Sub-agent specifications (definitions, system prompts, capabilities).
|
|
63
|
+
- Call-back protocols for Claude, Qwen, and AGY.
|
|
64
|
+
|
|
65
|
+
---
|
|
66
|
+
|
|
67
|
+
### CLI & Code Integration
|
|
68
|
+
|
|
69
|
+
#### [MODIFY] [awk.js](file:///Users/trungkientn/Dev/NodeJS/main-awf/bin/awk.js)
|
|
70
|
+
1. Register `goal` in the CLI command list and register the command parser.
|
|
71
|
+
2. Include the new `/goal` and `/goal-mode` commands in the help usage block.
|
|
72
|
+
3. Add the `codex-goal` skill folder to the default runtime list, ensuring it gets synced during `awkit install`.
|
|
73
|
+
|
|
74
|
+
#### [MODIFY] [codex-generators.js](file:///Users/trungkientn/Dev/NodeJS/main-awf/bin/codex-generators.js)
|
|
75
|
+
Add `codex-goal` to `SPECIALIST_SKILLS` list so that a Codex-compatible `.toml` agent spec is automatically generated for it.
|
|
76
|
+
|
|
77
|
+
---
|
|
78
|
+
|
|
79
|
+
## Verification Plan
|
|
80
|
+
|
|
81
|
+
### Automated Tests
|
|
82
|
+
- Run `node bin/awk.js doctor` to check installation state.
|
|
83
|
+
- Run `awkit status` to ensure all files are synchronized.
|
|
84
|
+
|
|
85
|
+
### Manual Verification
|
|
86
|
+
- Execute `node bin/awk.js goal "Build a simple greeting command line tool"` and verify that the orchestration loop initializes the plan, registers tasks, calls Qwen for implementation, and reviews using the critic sub-agent.
|
|
87
|
+
- Verify status checks, pause, and resume capabilities.
|
package/package.json
CHANGED
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Codex Goal Conductor - Goal Orchestration Runner for AWKit
|
|
5
|
+
* Pursues high-level development goals autonomously by executing Codex CLI.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
const fs = require('fs');
|
|
9
|
+
const path = require('path');
|
|
10
|
+
const { execSync, spawnSync } = require('child_process');
|
|
11
|
+
const os = require('os');
|
|
12
|
+
|
|
13
|
+
const GOALS_DIR = path.join(process.cwd(), 'codex-reports', 'goals');
|
|
14
|
+
const ACTIVE_GOAL_FILE = path.join(GOALS_DIR, 'active_goal.json');
|
|
15
|
+
|
|
16
|
+
const C = {
|
|
17
|
+
reset: '\x1b[0m',
|
|
18
|
+
red: '\x1b[31m',
|
|
19
|
+
green: '\x1b[32m',
|
|
20
|
+
yellow: '\x1b[33m',
|
|
21
|
+
cyan: '\x1b[36m',
|
|
22
|
+
gray: '\x1b[90m',
|
|
23
|
+
bold: '\x1b[1m',
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
const log = (msg) => console.log(msg);
|
|
27
|
+
const ok = (msg) => log(`${C.green}β${C.reset} ${msg}`);
|
|
28
|
+
const warn = (msg) => log(`${C.yellow}β ${C.reset} ${msg}`);
|
|
29
|
+
const err = (msg) => log(`${C.red}β${C.reset} ${msg}`);
|
|
30
|
+
const info = (msg) => log(`${C.cyan}βΉ${C.reset} ${msg}`);
|
|
31
|
+
|
|
32
|
+
// Parse args
|
|
33
|
+
const args = process.argv.slice(2);
|
|
34
|
+
let prompt = '';
|
|
35
|
+
let checkStatus = false;
|
|
36
|
+
let pauseGoal = false;
|
|
37
|
+
let resumeGoal = false;
|
|
38
|
+
let cancelGoal = false;
|
|
39
|
+
|
|
40
|
+
for (let i = 0; i < args.length; i++) {
|
|
41
|
+
if (args[i] === '--prompt' && args[i + 1]) {
|
|
42
|
+
prompt = args[i + 1];
|
|
43
|
+
i++;
|
|
44
|
+
} else if (args[i] === '--status') {
|
|
45
|
+
checkStatus = true;
|
|
46
|
+
} else if (args[i] === '--pause') {
|
|
47
|
+
pauseGoal = true;
|
|
48
|
+
} else if (args[i] === '--resume') {
|
|
49
|
+
resumeGoal = true;
|
|
50
|
+
} else if (args[i] === '--cancel') {
|
|
51
|
+
cancelGoal = true;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
// Ensure goals directory exists
|
|
56
|
+
fs.mkdirSync(GOALS_DIR, { recursive: true });
|
|
57
|
+
|
|
58
|
+
function getActiveGoal() {
|
|
59
|
+
if (fs.existsSync(ACTIVE_GOAL_FILE)) {
|
|
60
|
+
try {
|
|
61
|
+
return JSON.parse(fs.readFileSync(ACTIVE_GOAL_FILE, 'utf8'));
|
|
62
|
+
} catch (_) {}
|
|
63
|
+
}
|
|
64
|
+
return null;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
function saveActiveGoal(state) {
|
|
68
|
+
fs.writeFileSync(ACTIVE_GOAL_FILE, JSON.stringify(state, null, 2) + '\n', 'utf8');
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
function runGoal(goalPrompt) {
|
|
72
|
+
info(`Setting up Goal Conductor for: "${goalPrompt}"`);
|
|
73
|
+
|
|
74
|
+
// Load codex-goal skill rules
|
|
75
|
+
const skillPath = path.join(__dirname, '..', 'skills', 'codex-goal', 'SKILL.md');
|
|
76
|
+
let skillContent = '';
|
|
77
|
+
if (fs.existsSync(skillPath)) {
|
|
78
|
+
skillContent = fs.readFileSync(skillPath, 'utf8');
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
const fullPrompt = `${skillContent}\n\n[USER GOAL / OBJECTIVE]\n${goalPrompt}\n\nPlease parse the goal, partition it into steps, and coordinate execution. Call Claude, Qwen, and sub-agents as described in the guidelines.`;
|
|
82
|
+
|
|
83
|
+
const goalId = `goal_${Date.now()}`;
|
|
84
|
+
const state = {
|
|
85
|
+
goalId,
|
|
86
|
+
prompt: goalPrompt,
|
|
87
|
+
status: 'running',
|
|
88
|
+
timestamp: Date.now()
|
|
89
|
+
};
|
|
90
|
+
saveActiveGoal(state);
|
|
91
|
+
|
|
92
|
+
// Set goal_mode = true in current context if running checks
|
|
93
|
+
process.env.goal_mode = 'true';
|
|
94
|
+
|
|
95
|
+
info(`Launching Codex CLI Agent in Goal Orchestration Mode...`);
|
|
96
|
+
try {
|
|
97
|
+
const result = spawnSync('codex', [
|
|
98
|
+
fullPrompt,
|
|
99
|
+
'-s', 'workspace-write',
|
|
100
|
+
'--ask-for-approval', 'untrusted'
|
|
101
|
+
], { stdio: 'inherit' });
|
|
102
|
+
|
|
103
|
+
if (result.status === 0) {
|
|
104
|
+
state.status = 'completed';
|
|
105
|
+
saveActiveGoal(state);
|
|
106
|
+
ok('π Codex Goal Conductor execution finished.');
|
|
107
|
+
} else {
|
|
108
|
+
state.status = 'failed';
|
|
109
|
+
saveActiveGoal(state);
|
|
110
|
+
err('Codex Goal Conductor exited with an error.');
|
|
111
|
+
}
|
|
112
|
+
} catch (e) {
|
|
113
|
+
state.status = 'failed';
|
|
114
|
+
saveActiveGoal(state);
|
|
115
|
+
err('Failed to execute Codex CLI: ' + e.message);
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
// CLI Command Handling
|
|
120
|
+
if (checkStatus) {
|
|
121
|
+
const state = getActiveGoal();
|
|
122
|
+
if (!state) {
|
|
123
|
+
log('No active goal session tracked.');
|
|
124
|
+
} else {
|
|
125
|
+
log(`\nπ― Active Goal: "${state.prompt}"`);
|
|
126
|
+
log(`Status: ${state.status === 'running' ? C.cyan : state.status === 'completed' ? C.green : C.red}${state.status.toUpperCase()}${C.reset}`);
|
|
127
|
+
log(`Goal ID: ${state.goalId}`);
|
|
128
|
+
log(`To resume/check the Codex session, run: ${C.green}awkit goal --resume${C.reset}\n`);
|
|
129
|
+
}
|
|
130
|
+
} else if (pauseGoal) {
|
|
131
|
+
log('To pause Codex CLI execution, please press Ctrl+C in the active terminal run window.');
|
|
132
|
+
} else if (resumeGoal) {
|
|
133
|
+
const state = getActiveGoal();
|
|
134
|
+
if (state) {
|
|
135
|
+
info('Resuming last Codex session...');
|
|
136
|
+
try {
|
|
137
|
+
spawnSync('codex', ['resume', '--last'], { stdio: 'inherit' });
|
|
138
|
+
} catch (e) {
|
|
139
|
+
err('Failed to resume Codex session: ' + e.message);
|
|
140
|
+
}
|
|
141
|
+
} else {
|
|
142
|
+
warn('No active goal session to resume.');
|
|
143
|
+
}
|
|
144
|
+
} else if (cancelGoal) {
|
|
145
|
+
const state = getActiveGoal();
|
|
146
|
+
if (state) {
|
|
147
|
+
if (fs.existsSync(ACTIVE_GOAL_FILE)) {
|
|
148
|
+
fs.unlinkSync(ACTIVE_GOAL_FILE);
|
|
149
|
+
}
|
|
150
|
+
ok('Goal session cleared locally.');
|
|
151
|
+
} else {
|
|
152
|
+
warn('No active goal session to cancel.');
|
|
153
|
+
}
|
|
154
|
+
} else if (prompt) {
|
|
155
|
+
runGoal(prompt);
|
|
156
|
+
} else {
|
|
157
|
+
log('Usage:');
|
|
158
|
+
log(' node scripts/codex-goal.js --prompt "Goal Description"');
|
|
159
|
+
log(' node scripts/codex-goal.js --status');
|
|
160
|
+
log(' node scripts/codex-goal.js --pause');
|
|
161
|
+
log(' node scripts/codex-goal.js --resume');
|
|
162
|
+
log(' node scripts/codex-goal.js --cancel');
|
|
163
|
+
}
|
package/scripts/exec-rtk.js
CHANGED
|
@@ -24,6 +24,7 @@ function checkRtk() {
|
|
|
24
24
|
* @returns {Buffer|string}
|
|
25
25
|
*/
|
|
26
26
|
function execRtkSync(command, options = {}) {
|
|
27
|
+
const opts = { timeout: 30000, ...options };
|
|
27
28
|
const trimmed = command.trim();
|
|
28
29
|
|
|
29
30
|
// Only compress developer commands known to be verbose
|
|
@@ -33,10 +34,10 @@ function execRtkSync(command, options = {}) {
|
|
|
33
34
|
const isEligible = allEligible.some(prefix => trimmed.startsWith(prefix));
|
|
34
35
|
|
|
35
36
|
if (!checkRtk()) {
|
|
36
|
-
if (isEligible && !
|
|
37
|
-
return execSync(`${command} 2>&1 | tail -c 8000`, { ...
|
|
37
|
+
if (isEligible && !opts.stdio) {
|
|
38
|
+
return execSync(`${command} 2>&1 | tail -c 8000`, { ...opts, shell: true });
|
|
38
39
|
}
|
|
39
|
-
return execSync(command,
|
|
40
|
+
return execSync(command, opts);
|
|
40
41
|
}
|
|
41
42
|
|
|
42
43
|
if (trimmed.startsWith('rtk ')) {
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: codex-goal
|
|
3
|
+
description: >-
|
|
4
|
+
Codex Goal Conductor β Centralized autonomous goal-execution loop.
|
|
5
|
+
Orchestrates complex feature development by partitioning high-level goals
|
|
6
|
+
into tasks and distributing them to Claude, Qwen, standard agents, and sub-agents.
|
|
7
|
+
metadata:
|
|
8
|
+
stage: core
|
|
9
|
+
version: "1.0"
|
|
10
|
+
requires: codex (npm i -g @openai/codex)
|
|
11
|
+
tags: [goal, conductor, orchestration, multi-agent, autonomous]
|
|
12
|
+
agent: Goal Conductor
|
|
13
|
+
trigger: command
|
|
14
|
+
invocation-type: manual
|
|
15
|
+
priority: 5
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
# π― Codex Goal Conductor β Goal Execution Skill
|
|
19
|
+
|
|
20
|
+
> **Purpose:** Centralized orchestrator to pursue high-level development goals autonomously.
|
|
21
|
+
> **Principle:** Codex plans the tasks, registers them in Symphony, and delegates executions to other specialized agents.
|
|
22
|
+
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
## ποΈ Execution Model
|
|
26
|
+
|
|
27
|
+
In Goal Mode, Codex acts as the **Goal Conductor**. It runs an autonomous loop:
|
|
28
|
+
|
|
29
|
+
```
|
|
30
|
+
ββββββββββββββββββββββββ
|
|
31
|
+
β User Goal Prompt β
|
|
32
|
+
ββββββββββββ¬ββββββββββββ
|
|
33
|
+
β
|
|
34
|
+
βΌ
|
|
35
|
+
ββββββββββββββββββββββββ
|
|
36
|
+
β Codex Conductor βββββββββββββββββββββββββββ
|
|
37
|
+
ββββββββββββ¬ββββββββββββ β
|
|
38
|
+
β (Partitions & Delegates) β
|
|
39
|
+
ββββββββββββββββββββββΌβββββββββββββββββββββ β
|
|
40
|
+
βΌ βΌ βΌ β
|
|
41
|
+
ββββββββββββββββ ββββββββββββββββ ββββββββββββββββ β
|
|
42
|
+
β Claude CLI β β Qwen CLI β β Codex Sub- β β
|
|
43
|
+
β (Architect) β β (Executor) β β agents β β
|
|
44
|
+
ββββββββββββββββ ββββββββββββββββ ββββββββ¬ββββββββ β
|
|
45
|
+
β β
|
|
46
|
+
βΌ (Inspect/Review)β
|
|
47
|
+
ββββββββββββββββ β
|
|
48
|
+
β standard β β
|
|
49
|
+
β verificationβββββββββββ
|
|
50
|
+
ββββββββββββββββ
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
---
|
|
54
|
+
|
|
55
|
+
## π Operational Guidelines
|
|
56
|
+
|
|
57
|
+
### 1. Goal Partitioning
|
|
58
|
+
- Upon receiving a goal, the Conductor MUST create a local session tracker at `codex-reports/goals/<goal_id>/state.json`.
|
|
59
|
+
- It must partition the goal into explicit, non-overlapping step tasks (following Symphony task schema).
|
|
60
|
+
|
|
61
|
+
### 2. Task Delegation Protocol
|
|
62
|
+
For each task, the Goal Conductor selects the optimal runner:
|
|
63
|
+
- **Claude (Architect):** Runs for PRD generation, architectural design, and planning checks.
|
|
64
|
+
Command: `node scripts/claude-plan.js --prompt-file <prompt_file> --output <output_file>`
|
|
65
|
+
- **Qwen (Executor):** Runs for code implementation, refactoring, and file modifications.
|
|
66
|
+
Command: `node scripts/qwen-exec.js --prompt-file <prompt_file> --output <output_file> --sandbox workspace-write`
|
|
67
|
+
- **Gemini / AGY (General):** Runs for light scripting, quick checks, and fallback execution.
|
|
68
|
+
Command: `agy --model gemini-3.5-flash --print "<prompt>"`
|
|
69
|
+
- **Codex Sub-agents (Headless Experts):** Used for verification, reviews, and test generation.
|
|
70
|
+
Command: `codex exec "<prompt>" -s workspace-write`
|
|
71
|
+
|
|
72
|
+
### 3. Sub-Agent Autonomy & Callback
|
|
73
|
+
- Codex sub-agents (e.g. `critic`, `tester`, `ios-visual-qa-strategist`) are instantiated to run independently.
|
|
74
|
+
- When running, these sub-agents may delegate sub-problems back to Claude, Qwen, or AGY by executing the respective wrapper CLI commands.
|
|
75
|
+
- Sub-agents report their outputs back to the Goal Conductor in standardized Markdown files in `codex-reports/goals/<goal_id>/`.
|
|
76
|
+
|
|
77
|
+
---
|
|
78
|
+
|
|
79
|
+
## π« Safety & Mindful Rest Guards
|
|
80
|
+
- **destructive_actions:** If a proposed task involves destructive modifications (e.g., `rm -rf`, force push, database drop), the Conductor MUST pause and ask for explicit user confirmation.
|
|
81
|
+
- **loop_prevention:** If a single task fails or undergoes retry loops more than 3 times, the Conductor must pause, report the blocker details, and ask the user for guidance.
|
|
82
|
+
- **state_saves:** Save state changes to `codex-reports/goals/<goal_id>/state.json` at the end of every task execution.
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: π― Codex Goal Conductor β Pursue high-level goals autonomously using Codex coordination
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# /goal β Codex Goal Mode Workflow
|
|
6
|
+
|
|
7
|
+
> Launch Codex in Goal Mode to orchestrate multi-agent task execution and pursue complex goals.
|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
## π οΈ Step-by-Step Execution
|
|
12
|
+
|
|
13
|
+
### 1. Prerequisites Check
|
|
14
|
+
Ensure Codex CLI is installed on the system:
|
|
15
|
+
```bash
|
|
16
|
+
which codex || echo "NOT_INSTALLED"
|
|
17
|
+
```
|
|
18
|
+
If missing, suggest the user install it:
|
|
19
|
+
```bash
|
|
20
|
+
npm i -g @openai/codex
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
### 2. Launching the Goal
|
|
24
|
+
Initiate the goal execution loop:
|
|
25
|
+
```bash
|
|
26
|
+
awkit goal "Build a simple greeting command line tool"
|
|
27
|
+
```
|
|
28
|
+
Or execute through a specific pipeline command:
|
|
29
|
+
```bash
|
|
30
|
+
awkit pipeline goal "FeatureName"
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
### 3. Loop Execution Flow
|
|
34
|
+
1. **Initialize State:** Create directory `codex-reports/goals/<goal_id>/` and output the planned task list.
|
|
35
|
+
2. **Set Goal Mode:** Set `goal_mode = true` globally so that checkpoints automatically verify and bypass user blocks.
|
|
36
|
+
3. **Task Orchestration:** The loop script (`scripts/codex-goal.js`) executes tasks sequentially:
|
|
37
|
+
- Partition goal β Delegate plan/design to Claude.
|
|
38
|
+
- Implement code β Delegate implementation to Qwen.
|
|
39
|
+
- Verification β Run Codex sub-agents (`critic` or `tester`).
|
|
40
|
+
4. **State Persistence:** Save logs and state changes at the end of each step.
|
|
41
|
+
|
|
42
|
+
---
|
|
43
|
+
|
|
44
|
+
## π Sub-commands
|
|
45
|
+
|
|
46
|
+
### `/goal:status`
|
|
47
|
+
Check the status of the currently active goal and print active task reports:
|
|
48
|
+
```bash
|
|
49
|
+
node scripts/codex-goal.js --status
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
### `/goal:pause`
|
|
53
|
+
Pause the active goal execution loop and save the current state:
|
|
54
|
+
```bash
|
|
55
|
+
node scripts/codex-goal.js --pause
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
### `/goal:resume`
|
|
59
|
+
Resume the most recently paused or saved goal session:
|
|
60
|
+
```bash
|
|
61
|
+
node scripts/codex-goal.js --resume
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
### `/goal:cancel`
|
|
65
|
+
Cancel the active goal session, clean up temporary resources, and reset `goal_mode = false`:
|
|
66
|
+
```bash
|
|
67
|
+
node scripts/codex-goal.js --cancel
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
---
|
|
71
|
+
|
|
72
|
+
## π Sound Notifications
|
|
73
|
+
|
|
74
|
+
Upon task completion or session completion, trigger sound alerts:
|
|
75
|
+
- Success: `afplay /System/Library/Sounds/Glass.aiff && say "Goal phase completed successfully"`
|
|
76
|
+
- Paused/Blocker: `afplay /System/Library/Sounds/Basso.aiff && say "Goal execution paused. User attention required."`
|
|
77
|
+
|
|
78
|
+
---
|
|
79
|
+
|
|
80
|
+
## π« Fallback Policy
|
|
81
|
+
|
|
82
|
+
- If Codex CLI fails to launch or encounters critical issues:
|
|
83
|
+
- Fall back to standard **Gemini Conductor** or **Claude Planner** workflows (`scripts/claude-plan.js` or `agy`).
|
|
84
|
+
- If Qwen CLI is not available during execution:
|
|
85
|
+
- Fall back to `agy --model gemini-3.5-flash` for code generation.
|
|
86
|
+
- Ensure the orchestration script does not crash and logs error outputs gracefully to `codex-reports/goals/error.log`.
|