Files
stack/packages/skills/brain/SKILL.md
Jason Woltje 12abdfe81d feat(#93): implement agent spawn via federation
Implements FED-010: Agent Spawn via Federation feature that enables
spawning and managing Claude agents on remote federated Mosaic Stack
instances via COMMAND message type.

Features:
- Federation agent command types (spawn, status, kill)
- FederationAgentService for handling agent operations
- Integration with orchestrator's agent spawner/lifecycle services
- API endpoints for spawning, querying status, and killing agents
- Full command routing through federation COMMAND infrastructure
- Comprehensive test coverage (12/12 tests passing)

Architecture:
- Hub → Spoke: Spawn agents on remote instances
- Command flow: FederationController → FederationAgentService →
  CommandService → Remote Orchestrator
- Response handling: Remote orchestrator returns agent status/results
- Security: Connection validation, signature verification

Files created:
- apps/api/src/federation/types/federation-agent.types.ts
- apps/api/src/federation/federation-agent.service.ts
- apps/api/src/federation/federation-agent.service.spec.ts

Files modified:
- apps/api/src/federation/command.service.ts (agent command routing)
- apps/api/src/federation/federation.controller.ts (agent endpoints)
- apps/api/src/federation/federation.module.ts (service registration)
- apps/orchestrator/src/api/agents/agents.controller.ts (status endpoint)
- apps/orchestrator/src/api/agents/agents.module.ts (lifecycle integration)

Testing:
- 12/12 tests passing for FederationAgentService
- All command service tests passing
- TypeScript compilation successful
- Linting passed

Refs #93

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-03 14:37:06 -06:00

155 lines
3.5 KiB
Markdown

---
name: mosaic-brain
description: Capture ideas, brain dumps, and semantic search across your Mosaic Stack knowledge base.
homepage: https://mosaicstack.dev
metadata: { "clawdbot": { "emoji": "🧠", "requires": { "bins": ["curl", "jq"] } } }
---
# Mosaic Brain
Capture and search ideas, brain dumps, and notes in your Mosaic Stack workspace. Provides quick capture, semantic search, and tag management.
## Setup
1. Ensure Mosaic Stack API is running (default: `http://localhost:3001`)
2. Set environment variables:
```bash
export MOSAIC_API_URL="http://localhost:3001"
export MOSAIC_WORKSPACE_ID="your-workspace-uuid"
export MOSAIC_API_TOKEN="your-auth-token"
```
3. Optionally create `~/.config/mosaic/brain.conf`:
```bash
MOSAIC_API_URL=http://localhost:3001
MOSAIC_WORKSPACE_ID=your-workspace-uuid
MOSAIC_API_TOKEN=your-auth-token
```
## Common Commands
### Quick Brain Dump
Capture an idea quickly without thinking about categorization:
```bash
# Quick capture
./brain.sh capture "Had a great idea about using AI for code reviews"
# Capture with title
./brain.sh capture "Remember to follow up with the team about the new feature" --title "Team Follow-up"
```
### Create Detailed Idea
Create an idea with full metadata:
```bash
./brain.sh create \
--title "New Feature Idea" \
--content "Implement semantic search across all documents..." \
--tags "feature,ai,search" \
--category "product"
```
### Semantic Search
Search your brain using natural language:
```bash
# Query your knowledge base
./brain.sh query "What did I say about AI and code reviews?"
# Search with limit
./brain.sh search "project ideas" --limit 10
```
### List Ideas
```bash
# List recent ideas
./brain.sh list
# List with filters
./brain.sh list --limit 20 --tags "work,urgent"
```
### Get Specific Idea
```bash
./brain.sh get <idea-id>
```
### Update Idea
```bash
./brain.sh update <idea-id> \
--title "Updated Title" \
--tags "new,tags" \
--status "IN_PROGRESS"
```
### Delete Idea
```bash
./brain.sh delete <idea-id>
```
### Tag Management
```bash
# List all tags
./brain.sh tags
# Add tags to an idea
./brain.sh update <idea-id> --add-tags "urgent,review"
# Remove tags from an idea
./brain.sh update <idea-id> --remove-tags "old-tag"
```
## API Endpoints
The skill uses these Mosaic Stack API endpoints:
- **POST /api/ideas/capture** - Quick brain dump (minimal fields)
- **POST /api/ideas** - Create full idea with metadata
- **GET /api/ideas** - List ideas with filters
- **GET /api/ideas/:id** - Get specific idea
- **PATCH /api/ideas/:id** - Update idea
- **DELETE /api/ideas/:id** - Delete idea
- **POST /api/brain/query** - Semantic search/query
- **GET /api/brain/search** - Search ideas
## Configuration
Config file priority:
1. Environment variables
2. `~/.config/mosaic/brain.conf`
3. Default values
Required settings:
- `MOSAIC_API_URL` - API base URL (default: http://localhost:3001)
- `MOSAIC_WORKSPACE_ID` - Your workspace UUID
- `MOSAIC_API_TOKEN` - Authentication token
## Usage from Clawdbot
Natural language examples:
- "Remember this..." / "Note to self..." → Quick capture
- "What did I say about..." → Semantic search
- "Show me my recent ideas" → List ideas
- "Brain dump: [content]" → Quick capture
## Notes
- Quick capture (`capture`) is fastest - just dump your thought
- Semantic search (`query`) uses AI to find relevant ideas
- Regular search is keyword-based, faster but less intelligent
- Tags are automatically indexed for quick filtering
- Ideas support markdown formatting in content