rrce-workflow 0.3.6 → 0.3.8

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.
@@ -1,482 +0,0 @@
1
- # RRCE-Workflow Architecture
2
-
3
- > RR Context Engineering Workflow - A selection-agnostic agentic workflow system
4
- >
5
- > **Version**: 0.2.96 | **Last Updated**: 2026-01-02
6
-
7
- ## Overview
8
-
9
- RRCE-Workflow is a TUI-based agentic code workflow generator designed to work seamlessly across:
10
- - **OpenCode** (Native agentic TUI environment; RRCE installs subagents invoked via `@rrce_<agent>`)
11
- - **GitHub Copilot** (VSCode with MCP extension)
12
- - **Antigravity IDE** (Google's agentic coding environment)
13
- - **Claude Desktop** (MCP Server integration)
14
- - **Any MCP-compatible client**
15
-
16
- The system provides a structured multi-agent pipeline (7 agents) for software development tasks, with persistent knowledge caching, semantic search (RAG) across knowledge and code, and workspace-aware context management.
17
-
18
- ## Core Principles
19
-
20
- 1. **Selection Agnostic** - Identical prompts and behavior across all supported tools
21
- 2. **Workspace Aware** - Respects project boundaries and maintainer preferences
22
- 3. **Global Cache, Project Scoped** - Knowledge persists globally but is organized per-project
23
- 4. **Non-Intrusive** - Minimal footprint in workspace; state lives in user home directory
24
-
25
- ---
26
-
27
- ## Directory Structure
28
-
29
- ### Source Code Organization
30
-
31
- ```
32
- rrce-workflow/
33
- ├── agent-core/ # Agent prompts and templates (Source of Truth)
34
- │ ├── prompts/ # 7 agent system prompts (doctor, executor, init, etc.)
35
- │ ├── templates/ # Output templates for agents
36
- │ │ └── docs/ # Doc-type specific templates
37
- │ └── docs/ # Internal documentation (path-resolution.md)
38
- ├── bin/ # Executable entry points
39
- │ └── rrce-workflow.js # NPM binary wrapper
40
- ├── docs/ # High-level architecture docs (this file)
41
- ├── scripts/ # Maintenance and verification scripts
42
- ├── src/ # Source code
43
- │ ├── commands/ # CLI/TUI command implementations
44
- │ │ └── wizard/ # Interactive setup wizard (setup-flow, link-flow, etc.)
45
- │ ├── lib/ # Core utilities
46
- │ │ ├── detection.ts # Project scanning and detection (DetectedProject)
47
- │ │ ├── detection-service.ts # Singleton project service
48
- │ │ ├── git.ts # Git utilities
49
- │ │ ├── paths.ts # Path resolution (RRCE_HOME, RRCE_DATA, etc.)
50
- │ │ └── preferences.ts # User preference storage
51
- │ ├── mcp/ # MCP Server implementation
52
- │ │ ├── handlers/ # Decomposed request handlers
53
- │ │ │ ├── prompts.ts # Prompt/agent handlers
54
- │ │ │ ├── resources.ts # Resource handlers
55
- │ │ │ └── tools.ts # 12 MCP tools (search, index, tasks, etc.)
56
- │ │ ├── services/ # Backend services
57
- │ │ │ └── rag.ts # Semantic search with @xenova/transformers
58
- │ │ ├── ui/ # TUI components (Ink/React)
59
- │ │ │ └── components/ # Reusable UI components
60
- │ │ ├── config.ts # MCP configuration management
61
- │ │ ├── resources.ts # Project data access utilities
62
- │ │ └── server.ts # MCP Server entry point (Stdio transport)
63
- │ └── types/ # Global TypeScript definitions
64
- └── temp_rag_test/ # RAG testing environment
65
- ```
66
-
67
- ### Global Installation (`~/.rrce-workflow/`)
68
-
69
- ```
70
- ~/.rrce-workflow/
71
- ├── mcp.yaml # MCP server configuration (projects, permissions)
72
- ├── preferences.json # User preferences (global path overrides)
73
- ├── templates/ # Default template store
74
- │ ├── meta.template.json # Task metadata template
75
- │ └── docs/ # Doc-type specific templates
76
- └── workspaces/ # Project-scoped data (Global Mode)
77
- └── <workspace-name>/ # Named by project, not hash
78
- ├── config.yaml # Project configuration
79
- ├── knowledge/ # Project domain knowledge
80
- │ ├── project-context.md # Main context file
81
- │ ├── embeddings.json # RAG vector index
82
- │ └── <topic>.md # Additional knowledge files
83
- ├── refs/ # Reference documents
84
- └── tasks/ # Task state and artifacts
85
- └── <task-slug>/
86
- ├── meta.json # Task metadata, checklist, agent status
87
- ├── research/ # Research artifacts
88
- ├── planning/ # Planning artifacts
89
- ├── execution/ # Execution logs
90
- └── docs/ # Generated documentation
91
- ```
92
-
93
- ### Workspace Mode (`.rrce-workflow/`)
94
-
95
- ```
96
- <workspace>/
97
- └── .rrce-workflow/
98
- ├── config.yaml # Project-specific config
99
- ├── knowledge/ # Project knowledge (same structure as global)
100
- ├── refs/
101
- └── tasks/
102
- ```
103
-
104
- ---
105
-
106
- ## Path Resolution
107
-
108
- ### Storage Modes
109
-
110
- | Mode | Location | Use Case |
111
- |------|----------|----------|
112
- | `global` (default) | `~/.rrce-workflow/workspaces/<workspace-name>/` | Non-intrusive, survives repo deletion |
113
- | `workspace` | `<workspace>/.rrce-workflow/` | Portable, team-shareable |
114
-
115
- Configure via `config.yaml`:
116
- ```yaml
117
- mode: global # or: workspace
118
- name: my-project
119
- sourcePath: /path/to/source # For global mode: links data back to source
120
- ```
121
-
122
- ### Key Path Functions (`src/lib/paths.ts`)
123
-
124
- | Function | Purpose |
125
- |----------|---------|
126
- | `getEffectiveGlobalPath()` | Returns RRCE_HOME respecting user preferences |
127
- | `getConfigPath(workspaceRoot)` | Finds config.yaml (local or global) |
128
- | `resolveDataPath(mode, name, root)` | Resolves RRCE_DATA based on storage mode |
129
- | `detectWorkspaceRoot()` | Walks up from CWD to find project root |
130
-
131
- ### Environment Variables
132
-
133
- | Variable | Purpose | Default |
134
- |----------|---------|---------|
135
- | `RRCE_HOME` | Global installation path | `~/.rrce-workflow` |
136
- | `RRCE_WORKSPACE` | Explicit workspace root | Auto-detected |
137
-
138
- ### Template Variables
139
-
140
- | Variable | Resolves To |
141
- |----------|-------------|
142
- | `{{RRCE_HOME}}` | Global installation path |
143
- | `{{RRCE_DATA}}` | Data path (based on storage mode) |
144
- | `{{WORKSPACE_ROOT}}` | Workspace directory (source code location) |
145
- | `{{WORKSPACE_NAME}}` | Project name (from config or directory) |
146
-
147
- ### Workspace Detection Algorithm
148
-
149
- ```
150
- 1. If $RRCE_WORKSPACE is set → use it
151
- 2. Walk up from CWD, find first directory containing:
152
- - .git/
153
- - .rrce-workflow/config.yaml (new)
154
- - .rrce-workflow.yaml (legacy)
155
- 3. Fall back to CWD
156
- ```
157
-
158
- ### Project Detection (`src/lib/detection.ts`)
159
-
160
- The `DetectedProject` interface captures:
161
- ```typescript
162
- interface DetectedProject {
163
- name: string;
164
- path: string; // Absolute path to project root
165
- dataPath: string; // Path to .rrce-workflow data directory
166
- source: 'global' | 'local';
167
- sourcePath?: string; // For global mode: actual source code location
168
- knowledgePath?: string;
169
- tasksPath?: string;
170
- semanticSearchEnabled?: boolean;
171
- }
172
- ```
173
-
174
- Scanning priority:
175
- 1. Known projects from MCP config (name + path)
176
- 2. Global storage (`~/.rrce-workflow/workspaces/`)
177
- 3. Home directory recursive scan (up to depth 5)
178
-
179
- ### Cross-Project References
180
-
181
- Reference another project's context when needed:
182
- ```
183
- {{RRCE_HOME}}/workspaces/<other-project-name>/knowledge/project-context.md
184
- ```
185
-
186
- **Use cases:**
187
- - FE project referencing BE API specs
188
- - Microservice referencing shared library conventions
189
- - Monorepo packages accessing root-level decisions
190
-
191
- ---
192
-
193
- ## Agent Pipeline
194
-
195
- ```
196
- ┌─────────────────┐
197
- │ Init │ ← First run or re-sync
198
- │ (Project Setup) │
199
- └────────┬────────┘
200
-
201
-
202
- project-context.md + embeddings.json
203
-
204
- ┌────────────────────────────────────┴────────────────────────────────────┐
205
- ▼ │
206
- ┌─────────────────┐ ┌─────────────────┐ ┌─────────────────┐ ┌─────────────────┐
207
- │ Research │────▶│ Planning │────▶│ Executor │────▶│ Documentation │
208
- │ Discussion │ │ Discussion │ │ (Code Changes) │ │ │
209
- └─────────────────┘ └─────────────────┘ └─────────────────┘ └─────────────────┘
210
- │ │ │ │
211
- ▼ ▼ ▼ ▼
212
- research.md plan.md execution.md handover.md
213
- │ │ │ │
214
- └───────────────────────┴───────────────────────┴───────────────────────┘
215
-
216
- ┌────────┴────────┐
217
- ▼ ▼
218
- {{RRCE_DATA}}/ ┌─────────────────┐
219
- knowledge/ │ Sync │
220
- │ (Reconciliation)│
221
- └────────┬────────┘
222
-
223
- ┌────────┴────────┐
224
- ▼ ▼
225
- Doctor (Next Task)
226
- (Health Check)
227
- ```
228
-
229
- ### Agent Responsibilities
230
-
231
- | Agent | ID | Role | Input | Output |
232
- |-------|-----|------|-------|--------|
233
- | **Init** | `init` | Analyze codebase, establish project context, build RAG index | Workspace files | `project-context.md`, `embeddings.json` |
234
- | **Research** | `research_discussion` | Interactive requirements clarification, surface risks | User request + context | Research brief |
235
- | **Planning** | `planning_discussion` | Create actionable execution plan with checklist | Research brief | Prioritized task breakdown |
236
- | **Executor** | `executor` | Implement and verify - ONLY agent that modifies code | Plan + skill scope | Code + execution log |
237
- | **Documentation** | `documentation` | Synthesize and handover | All artifacts | Release-ready docs |
238
- | **Sync** | `sync` | Reconcile knowledge with codebase state | Codebase state | Updated knowledge files |
239
- | **Doctor** | `doctor` | Analyze codebase health using semantic search | Project + focus area | Health report, improvement tasks |
240
-
241
- ---
242
-
243
- ## Configuration
244
-
245
- ### MCP Configuration (`~/.rrce-workflow/mcp.yaml`)
246
-
247
- ```yaml
248
- # Projects exposed to MCP clients
249
- projects:
250
- - name: my-project
251
- path: /path/to/my-project
252
- permissions:
253
- knowledge: true
254
- tasks: true
255
- prompts: true
256
- semanticSearch:
257
- enabled: true
258
- model: Xenova/all-MiniLM-L6-v2
259
- ```
260
-
261
- ### Project Config (`<workspace>/.rrce-workflow/config.yaml` or global)
262
-
263
- ```yaml
264
- name: my-project
265
- mode: global # or: workspace
266
- sourcePath: /path/to/source # For global mode
267
-
268
- # Semantic search configuration
269
- semantic_search:
270
- enabled: true
271
-
272
- # Cross-project linking
273
- linked_projects:
274
- - other-project
275
- ```
276
-
277
- ### User Preferences (`~/.rrce-workflow/preferences.json`)
278
-
279
- ```json
280
- {
281
- "defaultGlobalPath": "/custom/path/.rrce-workflow",
282
- "useCustomGlobalPath": true
283
- }
284
- ```
285
-
286
- ### Project Config (`<workspace>/.rrce-workflow.yaml`)
287
-
288
- ```yaml
289
- version: 1
290
-
291
- # Cache control - repo maintainer can disable/customize
292
- cache:
293
- enabled: true # Set to false to disable global caching
294
- knowledge: true # Cache knowledge globally
295
- tasks: true # Cache task state globally
296
-
297
- # Template overrides
298
- templates:
299
- dir: ./my-templates # Local template directory (optional)
300
-
301
- # Project metadata
302
- project:
303
- name: "my-project" # Friendly name
304
-
305
- # Author override
306
- author: "maintainer-name" # Overrides global config for this project
307
- ```
308
-
309
- ---
310
-
311
- ## Prompt Frontmatter Schema
312
-
313
- All agent prompts in `agent-core/prompts/` use YAML frontmatter for metadata:
314
-
315
- ```yaml
316
- ---
317
- name: RRCE Executor
318
- description: Execute the planned tasks to deliver working code and tests.
319
- tools:
320
- - read
321
- - write
322
- - edit
323
- - bash
324
- - glob
325
- - grep
326
- - search_knowledge # MCP tool (becomes rrce_search_knowledge in OpenCode)
327
- - get_project_context # MCP tool
328
- - update_task # MCP tool
329
- arguments:
330
- - name: TASK_SLUG
331
- description: Enter the task slug to execute
332
- required: true
333
- - name: BRANCH
334
- description: Git branch for the work
335
- required: false
336
- ---
337
-
338
- # Agent System Prompt Content...
339
- ```
340
-
341
- ### Tool Categories
342
-
343
- | Category | Tools | Notes |
344
- |----------|-------|-------|
345
- | **Host Tools** | `read`, `write`, `edit`, `bash`, `grep`, `glob`, `webfetch` | Native to host environment |
346
- | **MCP Tools** | `search_knowledge`, `get_project_context`, `list_tasks`, etc. | Prefixed with `rrce_` in OpenCode |
347
-
348
- ---
349
-
350
- ## Multi-Tool Integration
351
-
352
- RRCE-Workflow prompts are designed to work across multiple AI coding tools via MCP and IDE-specific agent generation.
353
-
354
- ### Tool Support Matrix
355
-
356
- | Tool | MCP Config Location | Agent Location | Notes |
357
- |------|---------------------|----------------|-------|
358
- | **OpenCode** | `~/.config/opencode/opencode.json` | `.opencode/agent/rrce_*.md` | Custom subagents (invoke via `@rrce_*`) |
359
- | **Antigravity IDE** | `~/.gemini/antigravity/mcp_config.json` | `.agent/workflows/*.md` | Native workflow support |
360
- | **GitHub Copilot (VSCode)** | `.vscode/mcp.json` or global settings | `.github/prompts/*.prompt.md` | Custom agents format |
361
- | **Claude Desktop** | `~/.config/claude/claude_desktop_config.json` | N/A | MCP Server only |
362
-
363
- ### OpenCode Agent Transformation
364
-
365
- When generating agents for OpenCode (`src/commands/wizard/utils.ts`):
366
- - **Mode**: Set to `subagent` (not tab-switchable; invoke via mention)
367
- - **Invoke**: Use `@rrce_<agent>` (e.g., `@rrce_init`)
368
- - **Tools**:
369
- - Host tools (`read`, `write`, `edit`, `bash`, `grep`, `glob`, `webfetch`) pass through as-is
370
- - MCP tools are prefixed with `rrce_` (e.g., `rrce_search_knowledge`)
371
- - Tool list respects per-agent frontmatter restrictions
372
- - **Naming**: Agent IDs are prefixed with `rrce_` (underscore) to avoid collisions
373
-
374
- ### Generated Files
375
-
376
- **For OpenCode:**
377
- ```
378
- .opencode/agent/
379
- ├── rrce_init.md
380
- ├── rrce_research.md
381
- ├── rrce_planning.md
382
- ├── rrce_executor.md
383
- ├── rrce_documentation.md
384
- ├── rrce_sync.md
385
- └── rrce_doctor.md
386
- ```
387
-
388
- **For Antigravity IDE:**
389
- ```
390
- .agent/workflows/
391
- ├── init.md
392
- ├── research.md
393
- ├── planning.md
394
- ├── executor.md
395
- ├── documentation.md
396
- ├── sync.md
397
- └── doctor.md
398
- ```
399
-
400
- **For GitHub Copilot (VSCode):**
401
- ```
402
- .github/prompts/
403
- ├── init.prompt.md
404
- ├── research.prompt.md
405
- ├── planning.prompt.md
406
- ├── executor.prompt.md
407
- ├── documentation.prompt.md
408
- ├── sync.prompt.md
409
- └── doctor.prompt.md
410
- ```
411
-
412
- ---
413
-
414
- ## MCP Server Architecture
415
-
416
- The MCP Server (`src/mcp/`) provides the bridge between project knowledge and AI agents.
417
-
418
- ### Components
419
-
420
- | Component | Location | Purpose |
421
- |-----------|----------|---------|
422
- | **Server Entry** | `src/mcp/server.ts` | Initializes server, registers handlers, manages Stdio transport |
423
- | **Tool Handlers** | `src/mcp/handlers/tools.ts` | 12 MCP tools (search, index, tasks, resolve_path, etc.) |
424
- | **Prompt Handlers** | `src/mcp/handlers/prompts.ts` | Agent system prompts with context injection |
425
- | **Resource Handlers** | `src/mcp/handlers/resources.ts` | Knowledge files and project context as readable resources |
426
- | **RAG Service** | `src/mcp/services/rag.ts` | Semantic search with @xenova/transformers |
427
- | **Resources Utilities** | `src/mcp/resources.ts` | Project data access, task CRUD, context preamble generation |
428
-
429
- ### Context Injection
430
-
431
- When an agent requests a prompt via `get_agent_prompt`, the server injects a **Context Preamble** containing:
432
- - **System Resolved Paths**: Pre-resolved `RRCE_DATA`, `WORKSPACE_ROOT`, `RRCE_HOME`
433
- - **Available Projects**: List of exposed projects with active project marked
434
- - **Active Workspace**: Current project context for file operations
435
-
436
- ### Semantic Search (RAG)
437
-
438
- | Feature | Implementation |
439
- |---------|----------------|
440
- | **Embedding Model** | `Xenova/all-MiniLM-L6-v2` (configurable) |
441
- | **Index Location** | `<knowledge>/embeddings.json` |
442
- | **Similarity** | Cosine similarity |
443
- | **Indexable Extensions** | `.ts`, `.tsx`, `.js`, `.py`, `.go`, `.rs`, `.md`, etc. |
444
- | **Skip Directories** | `node_modules`, `.git`, `dist`, `build`, etc. |
445
-
446
- ---
447
-
448
- ## Installation Flow
449
-
450
- ```bash
451
- # Option 1: MCP Dashboard (recommended)
452
- npx rrce-workflow mcp
453
-
454
- # Option 2: Project Setup Wizard
455
- cd your-project
456
- npx rrce-workflow
457
-
458
- # Option 3: Start MCP Server directly (for IDE config)
459
- npx rrce-workflow mcp start
460
- ```
461
-
462
- ---
463
-
464
- ## Key Design Patterns
465
-
466
- 1. **MCP Decoupling**: Handlers separated from server instance for maintainability
467
- 2. **TUI/MCP Separation**: MCP runs in "interactive" mode to avoid stdio conflicts with TUI
468
- 3. **Prompt Parsing**: Frontmatter-based prompts with variable injection
469
- 4. **Hybrid Storage**: Global mode (clean repos) vs Workspace mode (portable)
470
- 5. **DetectedProject.sourcePath**: For global mode, links data back to actual source location
471
-
472
- ---
473
-
474
- ## Future Considerations
475
-
476
- - [ ] Web UI for knowledge browsing
477
- - [ ] Cross-project knowledge sharing (opt-in)
478
- - [ ] Plugin system for custom agents
479
- - [ ] Comprehensive test suite (Jest/Vitest)
480
- - [ ] CI/CD with GitHub Actions
481
- - [ ] Cross-platform parity (Windows/macOS)
482
-