@liriraid/agentflow-ai 1.0.20 → 1.0.22

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/README.md CHANGED
@@ -1,79 +1,231 @@
1
- # agentflow
1
+ # agentflow-ai
2
2
 
3
- Reusable multi-agent orchestration workspace for coding projects.
3
+ **Multi-Agent Orchestration System for AI-Powered Development**
4
4
 
5
- This package installs a CLI that creates a separate orchestrator workspace next to your real project. The generated workspace can be created in **English** or **Spanish**.
5
+ A reusable workspace orchestrator that coordinates multiple AI coding agents (Claude, Codex, OpenCode, etc.) to work **in parallel** on real projects, while keeping the project repository **completely clean** of orchestrator files.
6
6
 
7
7
  ```text
8
- my-product-workspace/
9
- my-product/ # real project, stays clean
10
- orchestrator-my-product/ # generated orchestrator workspace
8
+ project-workspace/
9
+ my-project/ # Real project (stays clean)
10
+ orchestrator-my-project/ # Orchestrator workspace (generated)
11
11
  ```
12
12
 
13
- ## Install
14
-
13
+ ## 🎯 What It Does
14
+
15
+ - **Coordinates multiple AI agents** (Claude, Codex, OpenCode, Gemini, Cursor, Abacus) to work simultaneously on your project.
16
+ - **Real-time monitoring** with a modern TUI (Terminal User Interface) that shows live agent status, queue, and progress.
17
+ - **Automatic task delegation** based on agent specialization (analysis, implementation, code review).
18
+ - **Persistent memory** using Engram to maintain context across sessions.
19
+ - **Spec-Driven Development (SDD)** support with OpenSpec for large, multi-phase changes.
20
+ - **Fallback system** that automatically reassigns tasks when an agent fails or reaches rate limits.
21
+ - **Multi-language support** (English and Spanish) for all templates and documentation.
22
+
23
+ ## ✨ Key Features
24
+
25
+ ### 1. **Sibling Workspace Model**
26
+ - The orchestrator creates a **separate workspace** next to your real project.
27
+ - Your project repository **stays completely clean** (no `QUEUE.md`, `logs/`, or orchestrator files).
28
+ - Agents work on the real project files via absolute paths configured in `orchestrator.config.json`.
29
+
30
+ ### 2. **Multi-Agent Coordination**
31
+ | Agent | Role | Priority | Notes |
32
+ |-------|------|----------|-------|
33
+ | **Claude-Orchestrator** | Session coordinator | - | Never implements code directly; delegates to workers |
34
+ | **Codex** | Primary implementation | 1st choice | Structured tasks, tests, docs |
35
+ | **OpenCode** | Analysis + Implementation | 2nd choice | Uses your configured model |
36
+ | **Claude-Worker** (Backend/Frontend) | Fallback implementation | 3rd choice | Takes over when Codex/OpenCode fail |
37
+ | **Gemini** | Code review/audits | Optional | Disabled by default |
38
+ | **Cursor/Abacus** | Mechanical tasks | Optional | Disabled by default |
39
+
40
+ ### 3. **Real-Time Operation**
41
+ - **fs.watch on QUEUE.md**: Detects changes in **~1-2 seconds** (Linux/macOS: direct file watch; Windows: directory watch fallback).
42
+ - **Live TUI updates**: The dashboard refreshes automatically when tasks are added, started, or completed.
43
+ - **Instant notifications**: Claude-Orchestrator receives alerts in `INBOX.md` and `NOTIFY.md` when tasks finish.
44
+
45
+ ### 4. **Smart Task Delegation**
46
+ - **Analysis tasks** → Always assigned to **OpenCode**.
47
+ - **Implementation tasks** → Assigned to **Codex** (1st) → **OpenCode** (2nd) → **Claude-Worker** (3rd).
48
+ - **Fallback chain**: `Codex → OpenCode → Claude-Worker` (automatic).
49
+
50
+ ### 5. **Persistent Memory & SDD**
51
+ - **Engram**: Stores decisions, bugs, and findings across sessions.
52
+ - **OpenSpec**: Supports `proposal.md`, `spec.md`, `design.md`, `tasks.md`, and `verify-report.md` for large changes.
53
+ - **Handoffs**: Session summaries for continuity.
54
+
55
+ ## 🚀 Installation
56
+
57
+ ### Global CLI (Recommended)
15
58
  ```bash
16
- npm i -g @liriraid/agentflow
59
+ pnpm add -g @liriraid/agentflow-ai
17
60
  ```
18
61
 
19
- ## Create a Workspace
20
-
21
- Interactive language selection:
22
-
62
+ ### Local Development
23
63
  ```bash
24
- agentflow init-workspace C:/code/my-project
64
+ git clone https://github.com/LiriRaid/agentflow-ai.git
65
+ cd agentflow-ai
66
+ pnpm install
25
67
  ```
26
68
 
27
- Direct language selection:
69
+ ## 🛠️ Quick Start
28
70
 
71
+ ### 1. Create an Orchestrator Workspace
29
72
  ```bash
73
+ # Interactive (asks for language)
74
+ agentflow init-workspace C:/code/my-project
75
+
76
+ # Direct (English)
30
77
  agentflow init-workspace C:/code/my-project --lang en
78
+
79
+ # Direct (Spanish)
31
80
  agentflow init-workspace C:/code/mi-proyecto --lang es
32
81
  ```
82
+ This creates a sibling workspace (e.g., `orchestrator-my-project/`) with all configuration files.
83
+
84
+ ### 2. Configure Repositories
85
+ Edit `orchestrator.config.json` in the generated workspace:
86
+ ```json
87
+ {
88
+ "repos": {
89
+ "backend": "C:/code/my-backend",
90
+ "frontend": "C:/code/my-frontend"
91
+ }
92
+ }
93
+ ```
33
94
 
34
- The selected language controls the generated workspace files:
35
-
36
- - `ORCHESTRATOR.md`
37
- - `CLAUDE.md`
38
- - `QUEUE.md`
39
- - `PROJECT.md`
40
- - `README.md`
41
- - `agents/`
42
- - `docs/`
43
- - `openspec/`
44
- - `.claude/`
45
- - `.codex/`
46
- - `.opencode/`
47
- - `.atl/`
48
- - `orchestrator.config.json`
49
-
50
- ## Runtime
51
-
52
- The package runtime remains language-aware through `workspaceLanguage` in the generated `orchestrator.config.json`.
53
-
54
- Start the TUI from the generated orchestrator workspace:
55
-
95
+ ### 3. Start the TUI
56
96
  ```bash
57
- cd C:/code/orchestrator-my-project
97
+ cd orchestrator-my-project
58
98
  agentflow ink --paused
59
99
  ```
100
+ **Controls:**
101
+ - `S`: Start/Resume
102
+ - `P`: Pause
103
+ - `R`: Reload queue
104
+ - `Q`: Quit (stops all agents)
105
+
106
+ ### 4. Launch Claude Code
107
+ Open a second terminal in the **orchestrator workspace** (not the real project):
108
+ ```bash
109
+ cd orchestrator-my-project
110
+ claude
111
+ ```
112
+ Then run:
113
+ ```
114
+ Read ORCHESTRATOR.md and start.
115
+ ```
60
116
 
61
- Then open Claude Code in the same workspace and start with the prompt from that workspace's `ORCHESTRATOR.md`.
62
-
63
- ## What Gets Packaged
117
+ ### 5. Request Work
118
+ Examples:
119
+ - `"Explore this project"` → OpenCode analyzes and reports.
120
+ - `"Add JWT authentication"` → OpenCode analyzes, then Codex/OpenCode implement.
121
+ - `"Refactor the API layer"` → OpenCode explores, then workers implement in parallel.
64
122
 
65
- The npm package ships:
123
+ ## 📁 Workspace Structure
66
124
 
67
- - `bin/`
68
- - `src/`
69
- - `scripts/`
70
- - `templates/en/`
71
- - `templates/es/`
72
- - `orchestrator.js`
73
- - `LICENSE`
125
+ The generated workspace includes:
74
126
 
75
- The workspace docs and prompts live inside `templates/en` and `templates/es`; they are copied into the generated workspace based on the selected language.
127
+ ```text
128
+ orchestrator-my-project/
129
+ ├── ORCHESTRATOR.md # Core rules for the orchestrator session
130
+ ├── CLAUDE.md # Routing rules for Claude
131
+ ├── QUEUE.md # Active task queue (TASK-NNN | title | agent | ...)
132
+ ├── ENGRAM.md # Persistent memory conventions
133
+ ├── orchestrator.config.json # Repos, agents, models, and profiles
134
+ ├── agents/ # Agent-specific instructions
135
+ │ ├── BACKEND.md
136
+ │ ├── FRONTEND.md
137
+ │ ├── CODEX.md
138
+ │ └── OPENCODE.md
139
+ ├── .claude/ # Local Claude skills and config
140
+ │ └── skills/ # Orchestrator skills (init, explore, etc.)
141
+ ├── .codex/ # Codex config
142
+ ├── .opencode/ # OpenCode config
143
+ ├── openspec/ # SDD artifacts
144
+ │ ├── changes/
145
+ │ └── templates/
146
+ ├── docs/ # Documentation
147
+ ├── logs/ # Execution logs
148
+ ├── handoffs/ # Session handoffs
149
+ └── progress/ # Agent progress reports
150
+ ```
76
151
 
77
- ## Acknowledgements
152
+ ## 🎛️ Configuration
153
+
154
+ ### Agent Configuration (`orchestrator.config.json`)
155
+ ```json
156
+ {
157
+ "projectName": "My Project",
158
+ "workspaceLanguage": "es",
159
+ "maxConcurrent": 5,
160
+ "pollIntervalSeconds": 5, // Fallback polling (realtime uses fs.watch)
161
+ "taskTimeoutMinutes": 30,
162
+ "repos": {
163
+ "backend": "C:/code/my-backend",
164
+ "frontend": "C:/code/my-frontend"
165
+ },
166
+ "agentProfiles": {
167
+ "claude": { "enabled": true, "localConfigDir": ".claude" },
168
+ "codex": { "enabled": true, "localConfigDir": ".codex" },
169
+ "opencode": { "enabled": true, "localConfigDir": ".opencode" }
170
+ },
171
+ "agents": {
172
+ "Backend": { "cli": "claude", "defaultRepo": "backend" },
173
+ "Frontend": { "cli": "claude", "defaultRepo": "frontend" },
174
+ "Codex": { "cli": "codex", "defaultRepo": "backend" },
175
+ "OpenCode": { "cli": "opencode", "defaultRepo": "frontend" }
176
+ }
177
+ }
178
+ ```
78
179
 
79
- Inspired by [Orquestador-AI](https://github.com/ariellontero/Orquestador-AI) by Ariel Lontero (originally MIT). Built from scratch with a different architecture (Ink TUI, npm package, multi-language template system).
180
+ ### Model Selection
181
+ Each agent uses the model you have configured in its own CLI. You can optionally override it by adding `"model": "model-name"` to any agent entry — for Claude this accepts values like `sonnet` or `opus`.
182
+
183
+ ## 🔄 Workflow Example
184
+
185
+ 1. **User Request**: `"Add user authentication to the backend."`
186
+ 2. **Claude-Orchestrator**:
187
+ - Creates `TASK-001` (OpenCode): `"Analyze current auth system"`
188
+ - Waits for OpenCode's report in `progress/PROGRESS-OpenCode.md`
189
+ 3. **OpenCode**:
190
+ - Analyzes the codebase.
191
+ - Writes findings to `progress/PROGRESS-OpenCode.md` and `INBOX.md`.
192
+ 4. **Claude-Orchestrator**:
193
+ - Reads OpenCode's report.
194
+ - Creates `TASK-002` (Codex): `"Implement JWT auth"` (depends on TASK-001).
195
+ 5. **Codex**:
196
+ - Implements the feature.
197
+ - Reports completion in `progress/PROGRESS-Codex.md`.
198
+ 6. **TUI**:
199
+ - Shows real-time updates (task status, agent activity, costs).
200
+
201
+ ## 📊 Supported Agents & Models
202
+
203
+ | Agent | CLI | Model | Implementation? | Notes |
204
+ |-------|-----|-------|----------------|-------|
205
+ | Backend | `claude` | auto | ✅ Yes | Claude-Worker for backend tasks |
206
+ | Frontend | `claude` | auto | ✅ Yes | Claude-Worker for frontend tasks |
207
+ | Codex | `codex` | auto | ✅ Yes | Primary implementation |
208
+ | OpenCode | `opencode` | auto | ✅ Yes | Secondary implementation |
209
+ | Gemini | `gemini` | auto | ❌ No | Audits/reviews only |
210
+ | Cursor | `cursor` | auto | ❌ No | Bulk edits only |
211
+ | Abacus | `abacusai` | auto | ❌ No | Small focused tasks |
212
+
213
+ ## 🛡️ Safety & Best Practices
214
+
215
+ - **No auto-commits**: Agents never run `git commit` or `git push`.
216
+ - **No YOLO by default**: Safe permissions mode is enabled unless `--yolo` is used.
217
+ - **Claude as reviewer**: Claude-Orchestrator validates all work before user approval.
218
+ - **Clean repos**: Project files stay untouched; orchestrator files live in the sibling workspace.
219
+ - **Fallback safety**: Tasks are automatically reassigned if an agent fails.
220
+
221
+ ## 📚 Documentation
222
+
223
+ - **Core Rules**: See `ORCHESTRATOR.md` in the generated workspace.
224
+ - **Agent Routing**: See `CLAUDE.md`.
225
+ - **Architecture**: See `docs/architecture.md`.
226
+ - **OpenSpec**: See `openspec/FLOW.md`.
227
+
228
+ ## 🤝 Acknowledgements
229
+
230
+ Inspired by [Orquestador-AI](https://github.com/ariellontero/Orquestador-AI) by Ariel Lontero (MIT).
231
+ Built from scratch with a modern architecture: **Ink TUI + React, npm package, real-time fs.watch, multi-language templates, and multi-agent coordination**.
package/bin/agentflow.mjs CHANGED
File without changes
package/orchestrator.js CHANGED
@@ -33,13 +33,11 @@ const CONFIG_TEMPLATE = {
33
33
  Backend: {
34
34
  cli: "claude",
35
35
  defaultRepo: "backend",
36
- model: "sonnet",
37
36
  instructionsFile: "agents/BACKEND.md",
38
37
  },
39
38
  Frontend: {
40
39
  cli: "claude",
41
40
  defaultRepo: "frontend",
42
- model: "sonnet",
43
41
  instructionsFile: "agents/FRONTEND.md",
44
42
  },
45
43
  Codex: {
@@ -1010,6 +1008,36 @@ function parseCompletedFromFile() {
1010
1008
  }
1011
1009
 
1012
1010
  const loggedUnknownAgents = new Set();
1011
+ let queueWatcher = null;
1012
+
1013
+ function setupQueueWatcher() {
1014
+ if (!fs.existsSync(QUEUE_FILE)) return;
1015
+
1016
+ if (queueWatcher) {
1017
+ try { queueWatcher.close(); } catch {}
1018
+ queueWatcher = null;
1019
+ }
1020
+
1021
+ try {
1022
+ queueWatcher = fs.watch(QUEUE_FILE, { persistent: false }, (eventType, filename) => {
1023
+ if (eventType === 'change' && filename === path.basename(QUEUE_FILE)) {
1024
+ log('DEBUG', `QUEUE.md changed, reloading queue immediately`);
1025
+ reloadQueue();
1026
+ scheduleNext();
1027
+ renderDashboard();
1028
+ }
1029
+ });
1030
+ queueWatcher.on('error', (err) => {
1031
+ log('WARN', `fs.watch failed for QUEUE.md: ${err.message}, falling back to polling`);
1032
+ queueWatcher = null;
1033
+ });
1034
+ log('INFO', 'Realtime QUEUE.md watcher enabled');
1035
+ } catch (err) {
1036
+ log('WARN', `Failed to setup QUEUE.md watcher: ${err.message}, using polling`);
1037
+ queueWatcher = null;
1038
+ }
1039
+ }
1040
+
1013
1041
  function reloadQueue() {
1014
1042
  state.queue = parseQueue();
1015
1043
  const activeIds = new Set([
@@ -1954,14 +1982,55 @@ setInterval(() => {
1954
1982
  if (command) applyControlCommand(command);
1955
1983
  }, 1000);
1956
1984
 
1957
- // Real-time queue detection — watches WORKSPACE directory (not the file directly)
1958
- // because on Windows fs.watch on a file is unreliable; watching the parent dir
1959
- // and filtering by filename is the stable pattern (same as AWAY MODE watcher).
1985
+ // Real-time queue detection — watches QUEUE.md directly with fallback to WORKSPACE directory
1986
+ // fs.watch on the file itself works reliably on Linux/macOS; fallback to WORKSPACE for Windows
1960
1987
  let _queueWatchDebounce = null;
1988
+ let _queueWatcher = null;
1989
+
1961
1990
  function startQueueWatcher() {
1991
+ if (_queueWatcher) {
1992
+ try { _queueWatcher.close(); } catch {}
1993
+ _queueWatcher = null;
1994
+ }
1995
+
1996
+ try {
1997
+ // Try to watch the file directly first (best for Linux/macOS)
1998
+ _queueWatcher = fs.watch(QUEUE_FILE, { persistent: false }, (eventType, filename) => {
1999
+ if (_queueWatchDebounce) clearTimeout(_queueWatchDebounce);
2000
+ _queueWatchDebounce = setTimeout(() => {
2001
+ if (!fs.existsSync(QUEUE_FILE)) return;
2002
+ const prevCount = state.queue.length;
2003
+ reloadQueue();
2004
+ if (!state.paused) scheduleNext();
2005
+ renderDashboard();
2006
+ if (state.queue.length > prevCount)
2007
+ log("INFO", WORKSPACE_LANGUAGE === "es"
2008
+ ? `Nueva tarea detectada en QUEUE.md (realtime)`
2009
+ : `New task detected in QUEUE.md (realtime)`);
2010
+ }, 10); // Faster debounce for direct file watch
2011
+ });
2012
+ _queueWatcher.on('error', () => {
2013
+ // Fallback to WORKSPACE directory watch if direct file watch fails (Windows)
2014
+ log('WARN', WORKSPACE_LANGUAGE === "es"
2015
+ ? `No se pudo verificar QUEUE.md directamente, usando watcher de directorio`
2016
+ : `Could not watch QUEUE.md directly, falling back to directory watcher`);
2017
+ setupFallbackQueueWatcher();
2018
+ });
2019
+ } catch (err) {
2020
+ log('WARN', `Queue watcher error: ${err.message}, using fallback`);
2021
+ setupFallbackQueueWatcher();
2022
+ }
2023
+ }
2024
+
2025
+ function setupFallbackQueueWatcher() {
2026
+ if (_queueWatcher) {
2027
+ try { _queueWatcher.close(); } catch {}
2028
+ _queueWatcher = null;
2029
+ }
2030
+
1962
2031
  try {
1963
2032
  const watchName = path.basename(QUEUE_FILE);
1964
- const watcher = fs.watch(WORKSPACE, {persistent: false}, (eventType, filename) => {
2033
+ _queueWatcher = fs.watch(WORKSPACE, { persistent: false }, (eventType, filename) => {
1965
2034
  if (filename !== watchName) return;
1966
2035
  if (_queueWatchDebounce) clearTimeout(_queueWatchDebounce);
1967
2036
  _queueWatchDebounce = setTimeout(() => {
@@ -1976,10 +2045,12 @@ function startQueueWatcher() {
1976
2045
  : `New task detected in QUEUE.md`);
1977
2046
  }, 50);
1978
2047
  });
1979
- watcher.on('error', () => {});
2048
+ _queueWatcher.on('error', () => {});
1980
2049
  } catch {}
1981
2050
  }
2051
+
1982
2052
  startQueueWatcher();
2053
+ setupQueueWatcher();
1983
2054
 
1984
2055
  // Slow fallback (5 min) — only runs if there is actually pending work or busy agents
1985
2056
  // fs.watch handles real-time; this is just a safety net
package/package.json CHANGED
@@ -1,60 +1,63 @@
1
- {
2
- "name": "@liriraid/agentflow-ai",
3
- "version": "1.0.20",
4
- "description": "Multi-agent workspace orchestrator with TUI. Coordinates AI coding agents over your real frontend and backend projects.",
5
- "author": "LiriRaid",
6
- "homepage": "https://github.com/LiriRaid/agentflow-ai#readme",
7
- "repository": {
8
- "type": "git",
9
- "url": "git+https://github.com/LiriRaid/agentflow-ai.git"
10
- },
11
- "bugs": {
12
- "url": "https://github.com/LiriRaid/agentflow-ai/issues"
13
- },
14
- "publishConfig": {
15
- "access": "public"
16
- },
17
- "main": "orchestrator.js",
18
- "bin": {
19
- "agentflow": "bin/agentflow.mjs"
20
- },
21
- "files": [
22
- "bin",
23
- "src",
24
- "templates",
25
- "orchestrator.js",
26
- "LICENSE"
27
- ],
28
- "scripts": {
29
- "start": "node orchestrator.js",
30
- "start:paused": "node orchestrator.js --paused",
31
- "start:ink": "node src/ink/index.mjs",
32
- "start:ink:paused": "node src/ink/index.mjs --paused",
33
- "cli:help": "node bin/agentflow.mjs --help"
34
- },
35
- "keywords": [
36
- "ai",
37
- "agents",
38
- "orchestrator",
39
- "agentflow-ai",
40
- "claude",
41
- "codex",
42
- "gemini",
43
- "cursor",
44
- "opencode",
45
- "abacus",
46
- "tui",
47
- "multi-agent",
48
- "coding-assistant",
49
- "openspec",
50
- "engram",
51
- "skills",
52
- "agent-config"
53
- ],
54
- "license": "MIT",
55
- "dependencies": {
56
- "blessed": "^0.1.81",
57
- "ink": "^5.2.1",
58
- "react": "^18.3.1"
59
- }
60
- }
1
+ {
2
+ "name": "@liriraid/agentflow-ai",
3
+ "version": "1.0.22",
4
+ "description": "Multi-agent workspace orchestrator with TUI. Coordinates AI coding agents over your real frontend and backend projects.",
5
+ "author": "LiriRaid",
6
+ "homepage": "https://github.com/LiriRaid/agentflow-ai#readme",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "git+https://github.com/LiriRaid/agentflow-ai.git"
10
+ },
11
+ "bugs": {
12
+ "url": "https://github.com/LiriRaid/agentflow-ai/issues"
13
+ },
14
+ "publishConfig": {
15
+ "access": "public"
16
+ },
17
+ "main": "orchestrator.js",
18
+ "bin": {
19
+ "agentflow": "bin/agentflow.mjs"
20
+ },
21
+ "files": [
22
+ "bin",
23
+ "src",
24
+ "templates",
25
+ "orchestrator.js",
26
+ "LICENSE"
27
+ ],
28
+ "engines": {
29
+ "node": ">=18.0.0"
30
+ },
31
+ "keywords": [
32
+ "ai",
33
+ "agents",
34
+ "orchestrator",
35
+ "agentflow-ai",
36
+ "claude",
37
+ "codex",
38
+ "gemini",
39
+ "cursor",
40
+ "opencode",
41
+ "abacus",
42
+ "tui",
43
+ "multi-agent",
44
+ "coding-assistant",
45
+ "openspec",
46
+ "engram",
47
+ "skills",
48
+ "agent-config"
49
+ ],
50
+ "license": "MIT",
51
+ "dependencies": {
52
+ "blessed": "^0.1.81",
53
+ "ink": "^5.2.1",
54
+ "react": "^18.3.1"
55
+ },
56
+ "scripts": {
57
+ "start": "node orchestrator.js",
58
+ "start:paused": "node orchestrator.js --paused",
59
+ "start:ink": "node src/ink/index.mjs",
60
+ "start:ink:paused": "node src/ink/index.mjs --paused",
61
+ "cli:help": "node bin/agentflow.mjs --help"
62
+ }
63
+ }
@@ -1,20 +1,20 @@
1
- #!/usr/bin/env node
2
- 'use strict';
3
- // Reads NOTIFY.md from the workspace and writes its content to stdout so the
4
- // Claude Code hook injects it into the interactive session.
5
- // The file is deleted after reading to avoid repeating the notification.
6
- const fs = require('fs');
7
- const path = require('path');
8
-
9
- const notifyFile = path.join(process.cwd(), 'NOTIFY.md');
10
- if (!fs.existsSync(notifyFile)) process.exit(0);
11
-
12
- const content = fs.readFileSync(notifyFile, 'utf8').trim();
13
- if (!content) {
14
- try { fs.unlinkSync(notifyFile); } catch {}
15
- process.exit(0);
16
- }
17
-
18
- try { fs.unlinkSync(notifyFile); } catch {}
19
-
20
- process.stdout.write('\n' + content + '\n');
1
+ #!/usr/bin/env node
2
+ 'use strict';
3
+ // Reads NOTIFY.md from the workspace and writes its content to stdout so the
4
+ // Claude Code hook injects it into the interactive session.
5
+ // The file is deleted after reading to avoid repeating the notification.
6
+ const fs = require('fs');
7
+ const path = require('path');
8
+
9
+ const notifyFile = path.join(process.cwd(), 'NOTIFY.md');
10
+ if (!fs.existsSync(notifyFile)) process.exit(0);
11
+
12
+ const content = fs.readFileSync(notifyFile, 'utf8').trim();
13
+ if (!content) {
14
+ try { fs.unlinkSync(notifyFile); } catch {}
15
+ process.exit(0);
16
+ }
17
+
18
+ try { fs.unlinkSync(notifyFile); } catch {}
19
+
20
+ process.stdout.write('\n' + content + '\n');
@@ -1,24 +1,24 @@
1
- {
2
- "hooks": {
3
- "Stop": [
4
- {
5
- "hooks": [
6
- {
7
- "type": "command",
8
- "command": "node .claude/hooks/notify-check.js"
9
- }
10
- ]
11
- }
12
- ],
13
- "UserPromptSubmit": [
14
- {
15
- "hooks": [
16
- {
17
- "type": "command",
18
- "command": "node .claude/hooks/notify-check.js"
19
- }
20
- ]
21
- }
22
- ]
23
- }
24
- }
1
+ {
2
+ "hooks": {
3
+ "Stop": [
4
+ {
5
+ "hooks": [
6
+ {
7
+ "type": "command",
8
+ "command": "node .claude/hooks/notify-check.js"
9
+ }
10
+ ]
11
+ }
12
+ ],
13
+ "UserPromptSubmit": [
14
+ {
15
+ "hooks": [
16
+ {
17
+ "type": "command",
18
+ "command": "node .claude/hooks/notify-check.js"
19
+ }
20
+ ]
21
+ }
22
+ ]
23
+ }
24
+ }