chore: add ralph infrastructure for rah-light strip-down

- prd.json with 15 user stories for phases 1-3
- prompt.md customized for deletion workflow
- progress.txt initialized

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
“BeeRad”
2026-01-29 15:01:10 +11:00
co-authored by Claude Opus 4.5
parent 9b2db68751
commit 08012a8e5a
5 changed files with 488 additions and 0 deletions
+211
View File
@@ -0,0 +1,211 @@
{
"project": "rah-light",
"context": "Stripping ra-h_os to a lightweight 2-panel knowledge graph UI with MCP server. Remove chat agents, voice, delegation system, memory pipeline. Keep: nodes/edges/dimensions CRUD, MCP server, workflows, extraction tools. The goal is a simple UI that technical users can run and connect their own agents to via MCP. Auth/subscription already removed from ra-h_os.",
"userStories": [
{
"id": "1",
"title": "Remove agent delegation system",
"description": "Delete the agent delegation infrastructure: src/services/agents/delegation.ts, all /api/rah/delegations/ routes, DelegationIndicator.tsx component, and any imports of these in other files. Update any files that import from deleted modules.",
"acceptanceCriteria": [
"src/services/agents/delegation.ts is deleted",
"app/api/rah/delegations/ directory is deleted (all routes inside)",
"src/components/agents/DelegationIndicator.tsx is deleted",
"No remaining imports of 'delegation' from services/agents",
"npm run type-check passes"
],
"passes": false,
"notes": ""
},
{
"id": "2",
"title": "Remove voice features",
"description": "Delete all voice-related code: hooks (useVoiceSession, useRealtimeVoiceClient, useAssistantTTS, useVoiceInterruption), voice API routes (/api/voice/, /api/realtime/), voice service (src/services/voice/), and remove voice-related UI/props from RAHChat.tsx. Update imports in components that use these.",
"acceptanceCriteria": [
"src/components/agents/hooks/useVoiceSession.ts deleted",
"src/components/agents/hooks/useRealtimeVoiceClient.ts deleted",
"src/components/agents/hooks/useAssistantTTS.ts deleted",
"src/components/agents/hooks/useVoiceInterruption.ts deleted",
"app/api/voice/ directory deleted",
"app/api/realtime/ directory deleted",
"src/services/voice/ directory deleted",
"RAHChat.tsx no longer imports or uses voice hooks",
"npm run type-check passes"
],
"passes": false,
"notes": ""
},
{
"id": "3",
"title": "Remove orchestration tools (delegateToWiseRAH)",
"description": "Delete agent orchestration tools that depend on internal agents: src/tools/orchestration/delegateToWiseRAH.ts. Keep workflow tools (getWorkflow, executeWorkflow, editWorkflow, listWorkflows). Update registry.ts to remove references to deleted tools.",
"acceptanceCriteria": [
"src/tools/orchestration/delegateToWiseRAH.ts deleted",
"src/tools/infrastructure/registry.ts no longer imports delegateToWiseRAH",
"npm run type-check passes"
],
"passes": false,
"notes": ""
},
{
"id": "4",
"title": "Remove chat agent components",
"description": "Delete internal chat agent UI components: WiseRAHPanel.tsx, MiniRAHPanel.tsx, AgentsPanel.tsx. These are agent-specific panels. Keep RAHChat.tsx (will be modified later), TerminalInput.tsx, TerminalMessage.tsx (may be reused or deleted later). Update any imports.",
"acceptanceCriteria": [
"src/components/agents/WiseRAHPanel.tsx deleted",
"src/components/agents/MiniRAHPanel.tsx deleted",
"src/components/agents/AgentsPanel.tsx deleted",
"No remaining imports of these components",
"npm run type-check passes"
],
"passes": false,
"notes": ""
},
{
"id": "5",
"title": "Remove chat API route",
"description": "Delete the main chat API route /api/rah/chat/route.ts and /api/rah/usage/route.ts since there's no internal chat agent. Keep /api/quick-add/route.ts if it's useful for MCP or simple ingestion.",
"acceptanceCriteria": [
"app/api/rah/chat/route.ts deleted",
"app/api/rah/usage/route.ts deleted",
"app/api/rah/ directory can be deleted if empty after this",
"npm run type-check passes"
],
"passes": false,
"notes": ""
},
{
"id": "6",
"title": "Simplify to two-panel layout",
"description": "Modify ThreePanelLayout.tsx to become a two-panel layout: Nodes (left) + Focus (right). Remove chat panel slot, ChatPane references, chat toggle (Cmd+J), floating chat bubble. Remove ChatPane.tsx. The layout should be: LeftToolbar | NodePanel/ViewsPane | FocusPanel.",
"acceptanceCriteria": [
"src/components/panes/ChatPane.tsx deleted",
"ThreePanelLayout.tsx no longer references ChatPane or chat toggle",
"Layout is 2 panels: nodes/views + focus",
"Chat-related keyboard shortcuts removed (Cmd+J)",
"npm run type-check passes"
],
"passes": false,
"notes": ""
},
{
"id": "7",
"title": "Remove RAHChat component",
"description": "Delete the main chat interface RAHChat.tsx and its supporting components (TerminalInput.tsx, TerminalMessage.tsx) since there's no chat. Also delete useSSEChat.ts hook. Remove the ReasoningTrace.tsx and ToolDisplay.tsx if they're only used by chat.",
"acceptanceCriteria": [
"src/components/agents/RAHChat.tsx deleted",
"src/components/agents/TerminalInput.tsx deleted",
"src/components/agents/TerminalMessage.tsx deleted",
"src/components/agents/hooks/useSSEChat.ts deleted",
"npm run type-check passes"
],
"passes": false,
"notes": "Check if ToolDisplay.tsx is used elsewhere before deleting"
},
{
"id": "8",
"title": "Clean up agent services",
"description": "Delete or simplify agent services that are no longer needed: src/services/agents/registry.ts (if only used for chat), workflowExecutor.ts (keep if workflows still work via MCP), autoEdge.ts, transcriptSummarizer.ts, toolResultUtils.ts. Keep quickAdd.ts if it's still useful.",
"acceptanceCriteria": [
"Review each file in src/services/agents/ - delete if only used by chat agents",
"Keep files that support MCP tools or standalone functionality",
"npm run type-check passes"
],
"passes": false,
"notes": "Be conservative - some services may be used by MCP tools"
},
{
"id": "9",
"title": "Clean up context services",
"description": "Review and clean up src/services/context/. Remove supabaseTokenRegistry.ts if present. Keep requestContext.ts and autoContext.ts if they're used by remaining functionality.",
"acceptanceCriteria": [
"Remove unused context services",
"Keep services that support MCP or remaining features",
"npm run type-check passes"
],
"passes": false,
"notes": ""
},
{
"id": "10",
"title": "Simplify settings panel",
"description": "Modify SettingsModal.tsx to remove tabs/sections for: agent configuration, voice settings, context viewer (if chat-specific). Keep: API keys, database viewer, external agents panel (MCP), theme toggle if present.",
"acceptanceCriteria": [
"SettingsModal.tsx simplified to essential settings only",
"No voice or agent-specific settings",
"API key management preserved",
"Database viewer preserved",
"npm run type-check passes"
],
"passes": false,
"notes": ""
},
{
"id": "11",
"title": "Remove unused npm packages",
"description": "After code cleanup, audit package.json and remove packages only needed by deleted features. Candidates: anything voice-related (@openai/realtime-api-beta if present), websocket packages only used by voice.",
"acceptanceCriteria": [
"package.json reviewed and unused packages removed",
"npm install succeeds",
"npm run type-check passes",
"npm run dev starts without errors"
],
"passes": false,
"notes": ""
},
{
"id": "12",
"title": "Remove dead types",
"description": "Clean up src/types/ - remove type definitions for deleted features (delegation types, voice types, chat-specific types). Keep database types, view types, prompt types.",
"acceptanceCriteria": [
"No dead type definitions remaining",
"All remaining types are used",
"npm run type-check passes"
],
"passes": false,
"notes": ""
},
{
"id": "13",
"title": "Audit and clean MCP server",
"description": "Review apps/mcp-server/server.js and stdio-server.js. Remove any tools that depend on deleted functionality. Ensure all remaining tools work standalone (node CRUD, edge CRUD, dimension CRUD, search, extraction, workflows).",
"acceptanceCriteria": [
"MCP servers only expose working tools",
"No tools depend on deleted chat/agent code",
"Both server.js and stdio-server.js updated consistently",
"npm run type-check passes"
],
"passes": false,
"notes": ""
},
{
"id": "14",
"title": "Update README for lite version",
"description": "Rewrite README.md to reflect the lite version: explain what it is (local knowledge graph UI + MCP server), how to run it, how to connect coding agents via MCP. Remove references to chat agents, voice features.",
"acceptanceCriteria": [
"README.md describes lite version accurately",
"Quick start: clone, npm install, npm run dev",
"MCP integration instructions included",
"No references to removed features"
],
"passes": false,
"notes": ""
},
{
"id": "15",
"title": "Final verification",
"description": "Run full verification: npm install, npm run type-check, npm run dev. Open localhost:3000 and verify: nodes list works, can create a node, focus panel shows node, dimensions sidebar works, settings modal opens with API keys.",
"acceptanceCriteria": [
"npm install succeeds",
"npm run type-check passes",
"npm run dev starts",
"UI loads at localhost:3000",
"Can create and view nodes",
"Dimensions sidebar works",
"Settings modal opens",
"No console errors for missing modules"
],
"passes": false,
"notes": ""
}
]
}
+11
View File
@@ -0,0 +1,11 @@
# Ralph Progress Log - RA-H Light Strip-Down
Started: Thu 29 Jan 2026 15:00:36 AEDT
Branch: feature/rah-light
Goal: Strip ra-h_os to lightweight 2-panel UI + MCP server
## Context
- Auth/subscription already removed
- Target: remove chat agents, voice, delegations, simplify to 2-panel
- Keep: nodes/edges/dimensions, MCP server, workflows, extraction
+98
View File
@@ -0,0 +1,98 @@
# Ralph Autonomous Agent - RA-H Light Strip-Down
You are an autonomous coding agent stripping down ra-h_os to create RA-H Light — a minimal knowledge graph UI with MCP server.
## Your Task
1. Read `ralph/prd.json` to find user stories with `passes: false`
2. Read `ralph/progress.txt` to understand what's been done this sprint
3. Check recent git commits for additional context
4. Pick ONE incomplete story (lowest ID number where `passes: false`)
5. Implement it completely
6. Run verification checks
7. Commit if all checks pass
8. Update prd.json and progress.txt
## Verification (CRITICAL)
Before marking ANY story as complete, you MUST run:
```bash
npm run type-check
```
Type-check must pass. If it fails, fix the issues before continuing.
**Note:** This project does not have a test suite, so skip `npm run test`.
**If the story involves UI changes** (story 6+), also verify with agent-browser:
```bash
agent-browser open http://localhost:3000
agent-browser snapshot -i # Check interactive elements exist
agent-browser screenshot verify.png # Visual sanity check
```
## Story Selection
Pick the story with the LOWEST ID number where `passes: false`. Stories are ordered by dependency:
- Stories 1-5: Remove backend/service code (delegation, voice, chat API)
- Story 6-7: Remove UI components (layout simplification, chat components)
- Stories 8-12: Cleanup (services, packages, types)
- Stories 13-15: Polish (MCP audit, README, final verification)
## Implementation Rules
1. **Read first** — Before deleting a file, grep for imports to find all references
2. **Delete cleanly** — When removing a file, also remove all imports of it
3. **Small commits** — One commit per story
4. **Type safety** — After deletion, run type-check to find broken imports
5. **Minimal changes** — Only what's needed to complete the story
## Deletion Strategy
When deleting files:
1. First, `grep -r "import.*from.*'deleted-file'" src/ app/` to find all imports
2. Delete the file
3. Update/remove all files that imported it
4. Run `npm run type-check` to find any missed references
5. Fix all type errors before committing
## After Implementation
1. Run `npm run type-check` — must pass
2. Git commit with message format:
```
feat(rah-light): [story-id] short description
- What was done
- Files deleted/changed
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
```
3. Update `ralph/prd.json`: set `passes: true` for completed story, add notes if relevant
4. Append to `ralph/progress.txt`:
```
## Story [id]: [title]
- Completed: [timestamp]
- Files deleted: [list]
- Files modified: [list]
- Learnings: [any gotchas]
```
## Completion
When ALL stories in prd.json have `passes: true`, respond with:
```
<promise>COMPLETE</promise>
```
## Important Paths
- `ralph/prd.json` — Story status (update passes: true when done)
- `ralph/progress.txt` — Sprint learnings (append after each story)
## Now
Read the prd.json and progress.txt below. Pick the lowest-numbered incomplete story. Implement it. Verify. Commit. Update status.
+63
View File
@@ -0,0 +1,63 @@
#!/bin/bash
set -e
# Ralph Single Iteration (Human-in-Loop Mode)
# Usage: ./ralph/ralph-once.sh
#
# Runs one iteration of Ralph interactively, allowing you to observe and steer
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
PROJECT_DIR="$(dirname "$SCRIPT_DIR")"
PRD_FILE="$SCRIPT_DIR/prd.json"
PROGRESS_FILE="$SCRIPT_DIR/progress.txt"
PROMPT_FILE="$SCRIPT_DIR/prompt.md"
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
echo " 🐕 Ralph Single Iteration (Interactive)"
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
# Verify required files exist
if [ ! -f "$PRD_FILE" ]; then
echo "❌ Error: $PRD_FILE not found"
echo "Create prd.json with your user stories first."
exit 1
fi
if [ ! -f "$PROMPT_FILE" ]; then
echo "❌ Error: $PROMPT_FILE not found"
exit 1
fi
# Initialize progress file if needed
if [ ! -f "$PROGRESS_FILE" ]; then
echo "# Ralph Progress Log" > "$PROGRESS_FILE"
echo "Started: $(date)" >> "$PROGRESS_FILE"
echo "" >> "$PROGRESS_FILE"
fi
echo "📋 PRD: $PRD_FILE"
echo "📝 Progress: $PROGRESS_FILE"
echo ""
cd "$PROJECT_DIR"
# Build the full prompt with current state
FULL_PROMPT="$(cat "$PROMPT_FILE")
---
## Current State
### prd.json
\`\`\`json
$(cat "$PRD_FILE")
\`\`\`
### progress.txt
\`\`\`
$(cat "$PROGRESS_FILE")
\`\`\`
"
# Run Claude Code with prompt via stdin
echo "$FULL_PROMPT" | claude --print --allowedTools "Edit,Write,Read,Bash,Glob,Grep"
Executable
+105
View File
@@ -0,0 +1,105 @@
#!/bin/bash
set -e
# Ralph Autonomous Agent Loop for RA-H
# Usage: ./ralph/ralph.sh [max_iterations]
#
# Runs Claude Code in a loop to implement user stories from prd.json
# Each iteration: picks a story → implements → verifies → commits → updates status
MAX_ITERATIONS=${1:-10}
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
PROJECT_DIR="$(dirname "$SCRIPT_DIR")"
PRD_FILE="$SCRIPT_DIR/prd.json"
PROGRESS_FILE="$SCRIPT_DIR/progress.txt"
PROMPT_FILE="$SCRIPT_DIR/prompt.md"
# Colors for output
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
BLUE='\033[0;34m'
NC='\033[0m' # No Color
echo -e "${BLUE}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}"
echo -e "${BLUE} 🐕 Ralph Autonomous Agent Loop${NC}"
echo -e "${BLUE}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}"
# Verify required files exist
if [ ! -f "$PRD_FILE" ]; then
echo -e "${RED}❌ Error: $PRD_FILE not found${NC}"
echo "Create prd.json with your user stories first."
exit 1
fi
if [ ! -f "$PROMPT_FILE" ]; then
echo -e "${RED}❌ Error: $PROMPT_FILE not found${NC}"
exit 1
fi
# Initialize progress file if needed
if [ ! -f "$PROGRESS_FILE" ]; then
echo "# Ralph Progress Log" > "$PROGRESS_FILE"
echo "Started: $(date)" >> "$PROGRESS_FILE"
echo "" >> "$PROGRESS_FILE"
fi
echo -e "${YELLOW}📋 PRD:${NC} $PRD_FILE"
echo -e "${YELLOW}📝 Progress:${NC} $PROGRESS_FILE"
echo -e "${YELLOW}🔄 Max iterations:${NC} $MAX_ITERATIONS"
echo ""
cd "$PROJECT_DIR"
for i in $(seq 1 $MAX_ITERATIONS); do
echo -e "${BLUE}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}"
echo -e "${GREEN}🔁 Iteration $i of $MAX_ITERATIONS${NC}"
echo -e "${BLUE}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}"
echo ""
# Build the full prompt with current state
FULL_PROMPT="$(cat "$PROMPT_FILE")
---
## Current State
### prd.json
\`\`\`json
$(cat "$PRD_FILE")
\`\`\`
### progress.txt
\`\`\`
$(cat "$PROGRESS_FILE")
\`\`\`
"
# Run Claude Code with the prompt via stdin
# Using --print for non-interactive mode
OUTPUT=$(echo "$FULL_PROMPT" | claude --print \
--allowedTools "Edit,Write,Read,Bash,Glob,Grep" 2>&1) || true
echo "$OUTPUT"
# Check for completion signal
if echo "$OUTPUT" | grep -q "<promise>COMPLETE</promise>"; then
echo ""
echo -e "${GREEN}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}"
echo -e "${GREEN}✅ Ralph complete! All stories passing.${NC}"
echo -e "${GREEN}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}"
exit 0
fi
# Brief pause between iterations
echo ""
echo -e "${YELLOW}⏳ Pausing 3s before next iteration...${NC}"
sleep 3
done
echo ""
echo -e "${YELLOW}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}"
echo -e "${YELLOW}⚠️ Max iterations ($MAX_ITERATIONS) reached${NC}"
echo -e "${YELLOW} Check progress.txt for status${NC}"
echo -e "${YELLOW}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}"
exit 1