Implement Phase 2 & 3: Complete HAP Terminal Interface with Patch Management

🎭 Phase 2: HAP Terminal Interface Implementation
 **Core Terminal Interface**: Interactive command-driven HAP terminal with help system
 **HMMM Message Composition System**:
   - New reasoning messages, thread replies, network queries, decision proposals
   - Complete message metadata handling (topics, threads, timestamps)
 **UCXL Context Browsing System**:
   - Address parsing, content retrieval from DHT encrypted storage
   - Search functionality, content creation, history navigation
 **Decision Participation System**:
   - Active decision listing, decision details with voting status
   - Vote casting with reasoning, decision proposals, HMMM integration

🔧 Phase 3: Enhanced Human Workflows
 **Patch Creation and Submission Workflows**:
   - Complete patch lifecycle management (create, review, submit, track)
   - Multiple patch types (context, code, config, docs)
   - UCXL integration with DHT storage, HMMM coordination
 **Time-Travel Diff Support**:
   - Temporal navigation operators (~~<n>, ^^<n>, @<time>)
   - Decision-hop analysis, visual diff display, version comparison

🏗️ **Architecture Highlights**:
- **Multi-binary structure**: Separate chorus-agent and chorus-hap binaries
- **Shared P2P runtime**: Both binaries use identical libp2p, DHT, HMMM, UCXL systems
- **Interactive sub-shells**: Dedicated command environments for HMMM, UCXL, patches, decisions
- **Network integration**: All features connect to distributed P2P agent network
- **Human-agent parity**: Humans participate as first-class network citizens

📦 **New Files**:
- internal/hapui/terminal.go: Complete HAP terminal interface (2400+ lines)
- prompts/human-roles.yaml: Role-based prompt configuration
- docs/decisions/*: HAP conversion decision record

🔗 **Integration Points**:
- HMMM: Collaborative reasoning and patch/decision announcements
- UCXL: Context addressing and version management
- DHT: Distributed storage of patches and content
- Decision System: Formal approval and consensus workflows

The HAP terminal interface now provides comprehensive human portal into the CHORUS
autonomous agent network, enabling collaborative reasoning, context sharing, patch
management, and distributed decision-making between humans and AI agents.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
anthonyrawlins
2025-09-07 09:38:14 +10:00
parent 0dbb6bb588
commit aea4d45fd8
6 changed files with 3466 additions and 22 deletions

View File

@@ -0,0 +1,46 @@
# Decision Record: Convert Human Markdown Prompts to CHORUS Role YAML
- Date: 2025-09-06
- UCXL Address: ucxl://arbiter:ops@CHORUS:prompt-migration/#/docs/decisions/2025-09-06-convert-human-prompts-to-roles-yaml.md
## Problem
Human-oriented prompt templates exist as Markdown files under `agentic-ai-prompt-templates/human/`. CHORUS now sources agent role prompts (S) and default instructions (D) at runtime from bind-mounted YAML/Markdown files. We need these human templates available in the new YAML format to configure agents via Docker volume binding without rebuilding images.
## Options Considered
1) Manual conversion of each Markdown file to a YAML role entry
- Pros: Tight editorial control
- Cons: Time-intensive, error-prone, hard to keep in sync
2) Automated converter script to parse Markdown sections and emit a consolidated `system_prompt` with metadata
- Pros: Fast, repeatable, easy to re-run when templates change
- Cons: Heuristics may miss atypical structures; requires review
3) Store raw Markdown and embed at runtime
- Pros: No conversion step
- Cons: Diverges from adopted loader schema, complicates composition and validation
## Decision
Adopt Option 2. Add a utility script `utilities/convert_human_prompts_to_yaml.py` that:
- Reads `agentic-ai-prompt-templates/human/*.md`
- Extracts title, Description, Tools, Use Cases, When to Use
- Constructs `system_prompt` as: "You are <Name>." + Description + Tools + Use Cases + When To Use
- Emits `project-queues/active/CHORUS/prompts/human-roles.yaml` with one role per file, using filename as role ID
- Populates advisory `defaults` (models/capabilities/expertise/max_tasks)
## Impact
- Roles become mountable via `CHORUS_PROMPTS_DIR` (e.g., `-v ../prompts:/etc/chorus/prompts:ro`)
- Agents can select any converted role via `CHORUS_ROLE=<role-id>`
- Future updates to human Markdown can be re-converted by re-running the script
## Rollback
- Remove `human-roles.yaml` from the prompts directory
- Agents will continue to use existing roles (`roles.yaml`) or default instructions only
## Compatibility Notes
- Loader merges by role ID; ensure IDs dont collide with existing `roles.yaml` (IDs are based on filenames)
- `defaults.md` remains the global instruction source and is unchanged by this migration
## Evidence / References
- Loader & schema: `pkg/prompt/types.go`, `pkg/prompt/loader.go`
- Prompts directory & compose: `prompts/README.md`, `docker/docker-compose.prompts.dev.yml`