### Initial Setup and Initialization Commands Source: https://context7.com/oimiragieo/agent-studio/llms.txt Run these commands to install dependencies, compile registries, initialize memory, reindex code, and validate the setup. Remember to copy and populate the .env file with your API keys. ```bash # Initial setup (installs deps, compiles registries, indexes code) pnpm run setup # Initialize memory database (SQLite schema creation) pnpm run memory:init # Regenerate agent registry after adding/modifying agents pnpm run agents:registry # Build full hybrid search index (BM25 + semantic vector) # ~12 min with GPU, ~17 min CPU-only pnpm run code:index:reindex # Verify everything is wired correctly pnpm run validate:full # Copy environment config and add API keys cp .env.example .env ``` -------------------------------- ### Copy Example Environment File Source: https://github.com/oimiragieo/agent-studio/blob/main/README.md Copy the example environment file to start configuring your API keys. This is the first step for setting up optional API keys for AI-powered skills. ```bash cp .env.example .env ``` -------------------------------- ### Drop-In Setup for Existing Projects Source: https://context7.com/oimiragieo/agent-studio/llms.txt Integrate Agent Studio into an existing project by copying the .claude directory, installing dependencies, and initializing core artifacts. Set the ANTHROPIC_API_KEY for memory operations. ```bash # 1. Copy .claude/ into the target repository root cp -r /path/to/agent-studio/.claude /path/to/your-project/ ``` ```bash # 2. Install Node.js dependencies (from your project root) pnpm install ``` ```bash # 3. Initialize core artifacts pnpm run memory:init pnpm run agents:registry pnpm run routing:prototypes ``` ```bash # 4. Optional: build code search index pnpm run code:index:reindex ``` ```bash # 5. Set required environment variable cp .env.example .env # Edit .env: set ANTHROPIC_API_KEY for memory extraction/dedup ``` -------------------------------- ### Validate Onboarding Setup Source: https://github.com/oimiragieo/agent-studio/blob/main/GETTING_STARTED.md Run the onboarding tool to validate your setup. This is recommended for first-time users. ```bash node .claude/tools/onboarding.mjs ``` -------------------------------- ### CLI Tool Test Coverage Example Source: https://github.com/oimiragieo/agent-studio/blob/main/tests/CLAUDE.md Outlines the tests for CLI tools, specifying which files cover CLI output formatting and package manager detection within the setup wizard. ```markdown | Test File | What It Covers | | -------------------------------- | ------------------------------------------ | | `memory-dashboard.test.cjs` | Memory dashboard CLI output and formatting | | `setup-package-manager.test.cjs` | Package manager detection in setup wizard | ``` -------------------------------- ### Run First-Time Setup Source: https://github.com/oimiragieo/agent-studio/blob/main/scripts/CLAUDE.md Execute this command once to set up the project environment. ```bash pnpm run setup ``` -------------------------------- ### Get Help for Rule Auditor Command Source: https://github.com/oimiragieo/agent-studio/blob/main/GETTING_STARTED.md Use the --help flag with any slash command to get detailed usage information. This example shows how to get help for the rule-auditor command. ```shell /rule-auditor --help ``` -------------------------------- ### Install Gemini CLI Source: https://github.com/oimiragieo/agent-studio/blob/main/GETTING_STARTED.md Install the Gemini CLI globally and verify the installation. This is a required step for using Codex skills. Authentication can be done via API key or session. ```bash # Install globally npm install -g @anthropic-ai/gemini ``` ```bash # Verify installation gemini --version ``` ```bash # Authenticate (requires Google Cloud API key) export GEMINI_API_KEY=your-api-key-here # or use session-based auth gemini login ``` -------------------------------- ### Install Latest Version and Dependencies Source: https://github.com/oimiragieo/agent-studio/blob/main/README.md Pull the latest code changes and install project dependencies. ```bash git pull && pnpm install ``` -------------------------------- ### Configure and Start Telegram Integration Source: https://context7.com/oimiragieo/agent-studio/llms.txt Set up environment variables for Telegram bot token and owner ID, then start the Telegram daemon. Alternatively, use in-session commands to manage the integration. ```bash # Configure .env: TELEGRAM_BOT_TOKEN= TELEGRAM_OWNER_ID= TELEGRAM_ALLOWED_USERS= CHANNEL_AUTO_START=true # Start the Telegram daemon pnpm run start:telegram # Or from within a Claude Code session: /enable-telegram /disable-telegram /restart-telegram # Key bot commands (send from Telegram): # /status — active loops, pending tasks, last heartbeat # /tasks — current task list with status # /memory QUERY — search agent memory for a keyword # /ask QUESTION — ask the AI and get a reply # /spawn TYPE DESC — spawn an agent (general-assistant, researcher, etc.) # /code TASK — mission-aware coding (classifies task → 16 agent types → TDD → grade 0-100) # HTTP API (runs at localhost:3101 when daemon is active): curl http://127.0.0.1:3101/status curl http://127.0.0.1:3101/history curl -X POST http://127.0.0.1:3101/send -d '{"message":"run tests"}' # Webhook endpoint for GitHub/CI events: curl -X POST http://127.0.0.1:3101/webhook \ -H "Content-Type: application/json" \ -d '{"event":"push","repo":"myrepo","branch":"main"}' ``` -------------------------------- ### Install Dependencies and Initialize Memory Source: https://github.com/oimiragieo/agent-studio/blob/main/GEMINI.md Run these commands to set up the project, initialize the memory database, and prepare agent registries and routing. ```bash pnpm install pnpm memory:init pnpm agents:registry pnpm routing:prototypes pnpm agents:catalog ``` -------------------------------- ### Install GitHub Copilot CLI (Optional) Source: https://github.com/oimiragieo/agent-studio/blob/main/GETTING_STARTED.md Install the GitHub Copilot CLI globally and authenticate with GitHub. This is an optional step for using Codex skills. ```bash # Install globally npm install -g @github/copilot ``` ```bash # Authenticate with GitHub gh auth login ``` ```bash # Verify installation copilot --version ``` -------------------------------- ### Install MarkItDown for File Conversion Source: https://github.com/oimiragieo/agent-studio/blob/main/README.md Install the MarkItDown library with all extras using pip to enable file conversion to Markdown for agent memory. ```bash pip install 'markitdown[all]' ``` -------------------------------- ### Verify Search Tool Installation Source: https://github.com/oimiragieo/agent-studio/blob/main/README.md Confirms that rga, fzf, and sg (ast-grep shim) have been installed correctly by checking their version numbers. ```powershell rga --version fzf --version sg --version ``` -------------------------------- ### Install OpenAI Codex CLI (Optional) Source: https://github.com/oimiragieo/agent-studio/blob/main/GETTING_STARTED.md Install the OpenAI Codex CLI globally and verify the installation. This is an optional step for using Codex skills. ```bash # Install globally npm install -g @openai/codex ``` ```bash # Verify installation codex --version ``` ```bash # Authenticate export OPENAI_API_KEY=your-api-key-here ``` -------------------------------- ### Start, Status, and Stop Search Daemon Source: https://github.com/oimiragieo/agent-studio/blob/main/README.md Commands to manage the search daemon. Use these to start, check the status of, or stop the background search process. ```bash pnpm search:daemon:start ``` ```bash pnpm search:daemon:status ``` ```bash pnpm search:daemon:stop ``` -------------------------------- ### Prewarm Search Daemon and Indexes Source: https://github.com/oimiragieo/agent-studio/blob/main/README.md Prepares the search daemon, LanceDB, and semantic path for faster initial queries. Run this after starting the daemon. ```bash pnpm search:daemon:prewarm ``` -------------------------------- ### Install Verified Skills from Marketplace Source: https://context7.com/oimiragieo/agent-studio/llms.txt Install verified skill packages from the marketplace using the provided command. This process includes security checks like HMAC-SHA256 signature verification and trust score assessment. ```bash # Install a verified skill package from the marketplace pnpm run skill:install # Verifies HMAC-SHA256 signature, checks 4-tier trust score, # path-traversal guards block ../ and URL-encoded variants ``` -------------------------------- ### Install and Run Validation Scripts Source: https://github.com/oimiragieo/agent-studio/blob/main/GETTING_STARTED.md Install project dependencies and run validation scripts to check configuration, models, workflows, and references. Use `pnpm validate` for fast checks or `pnpm validate:all` for full validation. ```bash # Install validation dependencies pnpm install # Run validation pnpm validate # Fast validation (config, models) pnpm validate:all # Full validation (includes workflows, references, CUJs, rule index) # Cleanup (recommended before commits) pnpm cleanup:check # Preview what would be deleted (safe) pnpm cleanup # Delete temp/runtime files (use with care) node .claude/tools/cleanup-repo.mjs --dry-run --reports-retention-days 5 # Optional: preview pruning reports older than 5 days node .claude/tools/cleanup-repo.mjs --execute --reports-retention-days 5 # Optional: prune reports older than 5 days (opt-in) ``` -------------------------------- ### Install Scoop for Windows Source: https://github.com/oimiragieo/agent-studio/blob/main/README.md Installs Scoop, a command-line installer for Windows, for non-administrator PowerShell environments. Ensure your execution policy is set to RemoteSigned. ```powershell Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser Invoke-RestMethod -Uri https://get.scoop.sh | Invoke-Expression ``` -------------------------------- ### Initialize Agent Studio Core Artifacts Source: https://github.com/oimiragieo/agent-studio/blob/main/README.md Execute these pnpm commands to initialize the core artifacts when dropping Agent Studio into another repository. Ensure Node.js and pnpm are installed. ```bash pnpm memory:init pnpm agents:registry pnpm routing:prototypes ``` -------------------------------- ### Cross-Platform Handoff Examples Source: https://github.com/oimiragieo/agent-studio/blob/main/GETTING_STARTED.md Illustrates how to seamlessly transfer context and tasks between different development environments like Claude, Cursor, and Factory Droid. This enables a fluid workflow across multiple tools. ```text # Claude to Cursor "Sync this context to Cursor for implementation" ``` ```text # Cursor to Factory Use @context-bridge to hand off to Factory ``` ```text # Factory to Claude Run Task tool with skill context-bridge to sync to Claude ``` -------------------------------- ### Automatic Keyword Matching Example Source: https://github.com/oimiragieo/agent-studio/blob/main/GETTING_STARTED.md Illustrates how user prompts are processed to detect keywords, match them against configured workflows, and select the highest priority matching workflow. ```text User: "Build a new authentication feature from scratch" → Keywords detected: "new", "from scratch" → Matches: `fullstack` workflow (keywords: "new project", "from scratch", "greenfield") → Priority: 2 (medium priority) → Selected: `fullstack` workflow → Executes: Planner (Step 0) → Full Stack Flow with all agents (Steps 1-N) ``` -------------------------------- ### Install Cursor Agent (Optional) Source: https://github.com/oimiragieo/agent-studio/blob/main/GETTING_STARTED.md Install the Cursor Agent via WSL on Windows. This is an optional step for using Codex skills. ```bash # Inside WSL wsl bash -lc "curl https://cursor.com/install -fsS | bash" ``` ```bash # Verify installation cursor-agent --version ``` -------------------------------- ### Install Claude Code CLI Source: https://github.com/oimiragieo/agent-studio/blob/main/GETTING_STARTED.md Install the Claude Code CLI globally and verify the installation. This is a required step for using Codex skills. ```bash # Install globally npm install -g @anthropic-ai/claude-code ``` ```bash # Verify installation claude --version ``` ```bash # Authenticate claude login ``` -------------------------------- ### Install Skill Package via MMP CLI Source: https://github.com/oimiragieo/agent-studio/blob/main/README.md Command to install a skill package using the Memory Marketplace Platform CLI. This command verifies the package signature and trust score before installation. ```bash pnpm skill:install ``` -------------------------------- ### Initiate Code Quality Review Source: https://github.com/oimiragieo/agent-studio/blob/main/GETTING_STARTED.md Start a comprehensive code review and refactoring process using the /code-quality command. ```bash /code-quality ``` -------------------------------- ### Start Quality Daemon Continuously Source: https://github.com/oimiragieo/agent-studio/blob/main/README.md Run the Autonomous Quality Daemon in a continuous loop in the foreground. This ensures ongoing quality checks and monitoring. ```bash pnpm quality:daemon:start ``` -------------------------------- ### Install Search Tools via Scoop Source: https://github.com/oimiragieo/agent-studio/blob/main/README.md Installs essential search utilities: rga (ripgrep-all) for searching archives and various file types, fzf for interactive fuzzy finding, and ast-grep for structural code analysis. ```powershell # Install rga (ripgrep-all) scoop install rga # Install fzf scoop install fzf # Install ast-grep (includes `sg` shim) scoop install ast-grep ``` -------------------------------- ### Configuration Test Coverage Example Source: https://github.com/oimiragieo/agent-studio/blob/main/tests/CLAUDE.md Specifies the test file for configuration validation, focusing on ensuring consistency in phase model assignments. ```markdown | Test File | What It Covers | | ----------------------------------- | ------------------------------------------------ | | `phase-models-consistency.test.cjs` | Validates phase model assignments are consistent | ``` -------------------------------- ### Configure Daemon Auto-Prewarm Source: https://github.com/oimiragieo/agent-studio/blob/main/README.md Enables automatic prewarming when the search daemon starts. Set `HYBRID_DAEMON_PREWARM` to `true`. ```bash HYBRID_DAEMON_PREWARM=true pnpm search:daemon:start ``` -------------------------------- ### Mobile Development Prompt Source: https://github.com/oimiragieo/agent-studio/blob/main/GETTING_STARTED.md Start a mobile development project with this prompt. The process includes platform strategy, UI design, feature implementation, and cross-device testing. ```bash "/mobile" ``` -------------------------------- ### Test File Structure Example Source: https://github.com/oimiragieo/agent-studio/blob/main/tests/CLAUDE.md Illustrates the hierarchical structure of the test suite, mirroring the project's source directories. This organization helps in locating tests for specific modules. ```tree tests/ ├── agents/ # Agent definition tests ├── cli/ # CLI tool tests ├── code-indexing/ # Code search and indexing tests ├── config/ # Configuration validation tests ├── hooks/ # Hook behavior tests ├── integration/ # Cross-component integration tests ├── lib/ # Library module tests (mirrors .claude/lib/) │ ├── agents/ # Agent config schema tests │ ├── code-indexing/ # BM25, embedding, hybrid search internals │ ├── creators/ # Creator ecosystem impact tests │ ├── memory/ # Memory system tests (LanceDB, tiers, pruning) │ ├── monitoring/ # Metrics, health, SLO monitoring tests │ ├── party-mode/ # Consensus voting tests │ ├── plan/ # Plan progress tracking tests │ ├── qa/ # QA criteria and report tests │ ├── reflection/ # Reflection system contract tests │ ├── routing/ # Routing logic tests │ ├── self-healing/ # Loop state management tests │ ├── spawn/ # Spawn template and assembly tests │ ├── text-processing/# Sentence chunker tests │ ├── tools/ # Tool library tests │ ├── utils/ # Utility module tests │ └── workflow/ # Workflow engine and state tests ├── misc/ # Miscellaneous validation tests ├── performance-profiling-minimal.test.cjs ├── phase-4/ # Phase 4 workflow pattern tests ├── routing-table.test.cjs ├── scale/ # Scale and performance tests ├── scripts/ # Script import and security tests ├── skills/ # Skill creator and lifecycle tests ├── spec-init.test.cjs ├── tools/ # Tool integration tests ├── unit/ # UI formatter and unit tests ├── utils/ # Token budget and utility tests ├── workflows/ # Workflow creator/updater tests ├── fixtures/ # Static test data (JSON, .gitkeep) └── (various root-level .test.cjs files) ``` -------------------------------- ### Cross-Platform Skill Invocation Examples Source: https://github.com/oimiragieo/agent-studio/blob/main/GETTING_STARTED.md Demonstrates how to invoke agent skills across different platforms like Claude, Cursor IDE, and Factory Droid. Each platform uses a distinct syntax for accessing functionalities such as rule selection, scaffolding, and auditing. ```text # Natural language invocation "Select rules for this project" "Scaffold a UserProfile component" "Audit src/components/ against our rules" ``` ```text # @ symbol invocation Use @rule-selector to configure rules Use @scaffolder to create a new component Use @rule-auditor to check this code ``` ```text # Task tool invocation Run Task tool with skill rule-selector Run Task tool with skill scaffolder Run Task tool with skill rule-auditor ``` -------------------------------- ### Build New Feature Prompt Source: https://github.com/oimiragieo/agent-studio/blob/main/GETTING_STARTED.md Use this prompt to initiate the workflow for building a new feature, such as a task management dashboard with user authentication. The system will select the 'fullstack' workflow and guide through planning, design, development, and QA. ```bash "I need a task management dashboard with user authentication" ``` -------------------------------- ### Agent Test Coverage Example Source: https://github.com/oimiragieo/agent-studio/blob/main/tests/CLAUDE.md Details the test files within the `tests/agents/` directory and the specific aspects of agent behavior they cover. This includes planner agent functionality. ```markdown | Test File | What It Covers | | ----------------------- | --------------------------------------------------- | | `core/planner.test.cjs` | Planner agent task creation and dependency handling | | `*.archived` | Archived agent tests (not run) | ``` -------------------------------- ### Register Hooks in settings.json Source: https://context7.com/oimiragieo/agent-studio/llms.txt Example configuration for registering various hooks like UserPromptSubmit, PreToolUse, PostToolUse, and SessionEnd in .claude/settings.json. Hooks can be filtered by 'matcher' strings. ```json // settings.json hook registration (abbreviated) { "hooks": { "UserPromptSubmit": [ { "matcher": "", "hooks": [ { "type": "command", "command": "node .claude/hooks/reflection/force-step0-execution.cjs" }, { "type": "command", "command": "node .claude/hooks/session/user-prompt-orchestrator.cjs" } ] } ], "PreToolUse": [ { "matcher": "", "hooks": [ { "type": "command", "command": "node .claude/hooks/routing/pre-tool-unified.cjs" } ] }, { "matcher": "Edit|Write|NotebookEdit", "hooks": [ { "type": "command", "command": "node .claude/hooks/routing/unified-creator-guard.cjs" }, { "type": "command", "command": "node .claude/hooks/safety/write-pretool-bundle.cjs" } ] }, { "matcher": "Bash", "hooks": [ { "type": "command", "command": "node .claude/hooks/safety/bash-pretool-bundle.cjs" } ] } ], "PostToolUse": [ { "matcher": "", "hooks": [ { "type": "command", "command": "node .claude/hooks/metrics/post-tool-metrics-unified.cjs" } ] }, { "matcher": "Edit|Write|NotebookEdit", "hooks": [ { "type": "command", "command": "node .claude/hooks/memory/sync-memory-index.cjs" } ] } ], "SessionEnd": [ { "matcher": "", "hooks": [ { "type": "command", "command": "node .claude/hooks/reflection/unified-reflection-handler.cjs" } ] } ] } } ``` -------------------------------- ### Migrate Agent Studio from v2.x to v3.0 Source: https://context7.com/oimiragieo/agent-studio/llms.txt Follow these steps to migrate your Agent Studio project to v3.0. This includes installing dependencies, previewing changes, applying the migration, and regenerating the agent registry. ```bash # 1. Pull latest and install git pull && pnpm install ``` ```bash # 2. Preview migration changes (dry run — no files written) pnpm run migrate:2x-to-3 --dry-run ``` ```bash # 3. Apply migration (backfills agent manifests, flags SSE transport) pnpm run migrate:2x-to-3 ``` ```bash # 4. Review backups created for modified agents ls .claude/context/tmp/agents-pre-v3-migration/ ``` ```bash # 5. Update any mcp.transport: "sse" → "streamable-http" entries in config # (script flags locations but does not rewrite config files) ``` ```bash # 6. Regenerate agent registry in v3 schema format pnpm run agents:registry ``` ```bash # 7. Enable enforcement when ready (optional — off by default) # V3_MANIFEST_REQUIRED=on (in .env) ``` ```bash # 8. Verify pnpm run test:framework ``` -------------------------------- ### Code Indexing Test Coverage Example Source: https://github.com/oimiragieo/agent-studio/blob/main/tests/CLAUDE.md Lists the test files for the code indexing system, detailing coverage for AST-grep integration, hybrid search CLI, and core search algorithms. ```markdown | Test File | What It Covers | | ------------------------------ | -------------------------------------------- | | `ast-grep-wrapper.test.cjs` | AST-grep wrapper for structural code search | | `cli.test.cjs` | Hybrid search CLI interface | | `hybrid-search-cli.test.cjs` | End-to-end CLI hybrid search behavior | | `hybrid-search.test.cjs` | Core hybrid search (BM25 + semantic ranking) | | `parser.test.cjs` | Code parser for chunk extraction | | `query-analyzer.test.cjs` | Query intent classification | | `result-ranker.test.cjs` | RRF result merging and ranking | | `ripgrep-integration.test.cjs` | ripgrep integration for text search | | `semantic-chunker.test.cjs` | Semantic chunking of source files | ``` -------------------------------- ### Advanced Interactive ripgrep Launcher Source: https://github.com/oimiragieo/agent-studio/blob/main/README.md Launches fzf with ripgrep integration, allowing dynamic reloading of search results as the user types. The `rg_prefix` variable sets up the ripgrep command, and `--bind` configures fzf's behavior for starting and changing search queries. ```bash : | rg_prefix='rg --column --line-number --no-heading --color=always --smart-case' \ fzf --ansi --disabled \ --bind 'start:reload:$rg_prefix ""' \ --bind 'change:reload:$rg_prefix {q} || true' ``` -------------------------------- ### Manage Agent Costs with Cost Tracker Source: https://github.com/oimiragieo/agent-studio/blob/main/GETTING_STARTED.md Use the cost-tracker tool to monitor token usage and estimate costs for agent sessions. This includes viewing reports, getting stats for specific agents, and forecasting future expenses. ```bash # View cost report node .claude/tools/cost-tracker.mjs report # Get cost stats for specific agent node .claude/tools/cost-tracker.mjs stats developer 30 # Get cost forecast node .claude/tools/cost-tracker.mjs forecast 30 ``` -------------------------------- ### Display Help Instructions Source: https://github.com/oimiragieo/agent-studio/blob/main/scripts/validation/README-VERSION-VALIDATION.md Run this command to display the usage instructions and available options for the validation script. ```bash node scripts/validate-rule-index-paths.mjs --help ``` -------------------------------- ### Configuration Loading Details Source: https://github.com/oimiragieo/agent-studio/blob/main/scripts/channels/daemon/CLAUDE.md Explains how the configuration is loaded from environment variables and JSON files, including user access control. ```javascript Reads from `.env` (via `loadDotenv`) and `~/.claude/channels/config.json`. ``` ```javascript Builds allowed users set from `TELEGRAM_ALLOWED_USERS`, `TELEGRAM_OWNER_ID`, and `~/.claude/channels/telegram/access.json`. ``` -------------------------------- ### Start A2A Discovery Server Source: https://github.com/oimiragieo/agent-studio/blob/main/GETTING_STARTED.md Start the A2A discovery server to serve AgentCards and enable external agent discovery. The server listens for AgentCards at /.well-known/agent-card.json. ```plaintext "Start A2A discovery server" ``` -------------------------------- ### Analyze Token Budget and Refactor Recommendations Source: https://github.com/oimiragieo/agent-studio/blob/main/README.md Use this command for token budget analysis within a specified directory. It provides file/directory sizes, token estimates, and recommends splitting oversized source files (>15K tokens) for better AI agent readability. ```bash pnpm search:tokens .claude/lib ``` -------------------------------- ### Adding New Platforms - Daemon Implementation Source: https://github.com/oimiragieo/agent-studio/blob/main/scripts/channels/README.md Steps to add new platforms like Discord or Slack by implementing specific methods and configuration files within the daemon structure. ```javascript 1. Create `daemon/sources/discord.cjs` implementing `start()` and `stop()` methods 2. Create `daemon/sinks/discord.cjs` implementing `send(chatId, text, opts)` 3. Add config section in `daemon/config.cjs` 4. Wire in `daemon/index.cjs` 5. The router, dispatcher, memory, and renderer are platform-agnostic ``` -------------------------------- ### Copy Agent Studio Configuration (Bash) Source: https://github.com/oimiragieo/agent-studio/blob/main/GETTING_STARTED.md Clone or download the Agent Studio repository and copy the configuration files to your project directory using bash commands. ```bash cp -r .claude/ /path/to/your/project/ cp .claude/CLAUDE.md /path/to/your/project/CLAUDE.md ``` -------------------------------- ### Worker Summary Source: https://github.com/oimiragieo/agent-studio/blob/main/GETTING_STARTED.md Run this command to get a summary of the worker's last ticks and status. ```bash pnpm worker:summary ``` -------------------------------- ### Run All Tests Source: https://github.com/oimiragieo/agent-studio/blob/main/scripts/channels/PLAN-PHASE5.md Execute the full test suite for the project. This is a comprehensive check performed after Phase 5 is complete. ```bash pnpm test ``` -------------------------------- ### Memory System Operations Source: https://github.com/oimiragieo/agent-studio/blob/main/README.md Commands related to memory lineage and the Skill Marketplace. These are used for managing memory records and installing skills. ```bash pnpm mmp:lineage # walk ancestry chain for a CAT7 memory record ``` ```bash pnpm mmp:descendants # list all downstream records ``` ```bash pnpm skill:install # install a verified skill package from the marketplace ``` -------------------------------- ### Analyze Project Structure and Dependencies Source: https://github.com/oimiragieo/agent-studio/blob/main/README.md This command displays the project structure, dependencies, and generates a Mermaid diagram for visualization. It helps in understanding the project's architecture. ```bash pnpm search:structure ``` -------------------------------- ### Trigger Memory Consolidation via HTTP API Source: https://github.com/oimiragieo/agent-studio/blob/main/scripts/channels/README.md Initiate the memory consolidation process by making a GET request to the `/dream` endpoint. ```bash curl http://127.0.0.1:3101/dream ``` -------------------------------- ### Artifact Naming with Template Variables Source: https://github.com/oimiragieo/agent-studio/blob/main/GETTING_STARTED.md Provides an example of how to use template variables, such as `{{workflow_id}}`, in artifact filenames to ensure unique and context-aware naming. ```yaml outputs: - plan-{{workflow_id}}.json # Resolves to: plan-1735123456-abc123.json ``` -------------------------------- ### Control Telegram Daemon via CLI Source: https://github.com/oimiragieo/agent-studio/blob/main/scripts/channels/README.md Use these commands to start, stop, check the status, or restart the Telegram channel daemon from the command line. ```bash node scripts/channels/telegram-ctl.cjs start node scripts/channels/telegram-ctl.cjs status node scripts/channels/telegram-ctl.cjs stop node scripts/channels/telegram-ctl.cjs restart ``` -------------------------------- ### Configure Context Budget Thresholds Source: https://github.com/oimiragieo/agent-studio/blob/main/README.md Set the warning threshold in tokens for context size before a session reaches the compression threshold. Enable hard-blocking for spawns that exceed 1.6x the threshold. ```bash SPAWN_BUDGET_DEFAULT_CONTEXT=50000 ``` ```bash SPAWN_BUDGET_HARD=on ``` -------------------------------- ### Telegram Control Script Commands Source: https://github.com/oimiragieo/agent-studio/blob/main/scripts/channels/daemon/CLAUDE.md Demonstrates the command-line interface for controlling the Telegram bot, including starting, stopping, checking status, and performing diagnostic checks. ```bash start, stop, status, restart, doctor (validate config), doctor --fix (validate + auto-repair) ``` -------------------------------- ### Run Comprehensive Test Suite Source: https://github.com/oimiragieo/agent-studio/blob/main/scripts/validation/README-VERSION-VALIDATION.md Execute this command to run the full test suite for version validation, ensuring all scenarios are covered. ```bash pnpm test:version-validation ``` -------------------------------- ### Memory Marketplace CLI Source: https://github.com/oimiragieo/agent-studio/blob/main/README.md Command-line interface for interacting with the Memory Marketplace. ```APIDOC ## Memory Marketplace CLI ### Description Tools for inspecting and managing memory records and skill packages. ### Commands - `pnpm mmp:lineage `: Inspect the derivation graph of a memory record. - `pnpm mmp:descendants `: Inspect downstream records influenced by a memory record. - `pnpm skill:install `: Install a verified skill package after signature and trust score verification. ``` -------------------------------- ### Control Telegram Daemon via Claude Code Skills Source: https://github.com/oimiragieo/agent-studio/blob/main/scripts/channels/README.md Manage the Telegram daemon using these commands within Claude Code skills for setup, enabling, and disabling. ```bash /setup-telegram # verify config /enable-telegram # start daemon /disable-telegram # stop daemon ``` -------------------------------- ### Initialize and Manage Memory System Source: https://context7.com/oimiragieo/agent-studio/llms.txt Commands to initialize the SQLite schema, check memory health, view the memory dashboard, run weekly maintenance, and backfill legacy JSON files into the entity index. ```bash # Initialize SQLite schema (run once) pnpm run memory:init ``` ```bash # Check memory health pnpm run memory:health # Output: { status: "ok", stmCount: 12, mtmCount: 45, ltmCount: 8, ... } ``` ```bash # View memory dashboard (token budgets, SLO metrics) pnpm run memory:dashboard ``` ```bash # Run weekly maintenance (compaction, archival) pnpm run memory:weekly ``` ```bash # Backfill patterns.json / gotchas.json into SQLite entity index pnpm run memory:sync-json ``` ```bash # Archive oversized learnings.md (triggers at 40KB) node .claude/lib/memory/memory-manager.cjs archive-learnings ``` -------------------------------- ### Start Heartbeat Loops Manually Source: https://github.com/oimiragieo/agent-studio/blob/main/README.md Initiate heartbeat loops manually within your Claude Code session using this command. This ensures the agent runtime remains healthy and indexed. ```bash /heartbeat-start ``` -------------------------------- ### Preview Migration Changes Source: https://github.com/oimiragieo/agent-studio/blob/main/README.md Run the migration script in dry-run mode to preview changes without writing any files. ```bash pnpm migrate:2x-to-3 --dry-run ``` -------------------------------- ### Wire Tick Engine into Daemon Index Source: https://github.com/oimiragieo/agent-studio/blob/main/scripts/channels/PLAN-PHASE5.md Conditionally initializes and starts the TimerSource (acting as a tick engine) if proactive mode is enabled in the configuration. It enqueues events via the dispatcher. ```javascript if (config.proactive?.enabled) { const tickEngine = new TimerSource(config.proactive, event => dispatcher.enqueue(event)); sources.push(tickEngine); tickEngine.start(); log('Proactive tick engine started'); } ``` -------------------------------- ### Skill Marketplace Environment Variables Source: https://context7.com/oimiragieo/agent-studio/llms.txt Configure the skill marketplace by setting these environment variables. Ensure SKILL_MARKETPLACE_HMAC_KEY is at least 32 characters long. ```bash SKILL_MARKETPLACE_HMAC_KEY= ``` ```bash SKILL_MARKETPLACE_MIN_TRUST=0.7 # 0.0–1.0 trust threshold ``` ```bash SKILL_MARKETPLACE_REGISTRY_URL=https://... ``` -------------------------------- ### Non-Blocking Task Execution Example Source: https://github.com/oimiragieo/agent-studio/blob/main/scripts/channels/daemon/CLAUDE.md Illustrates the asynchronous nature of task execution, where tasks spawned by Claude are handled in a background TaskPool, allowing immediate continuation of message processing. ```javascript claudeAsync() in `claude-cli.cjs` — Non-blocking `spawn`-based wrapper alongside `claudeSync()`. Returns `{ child, promise, cancel }`. ``` ```javascript executeTaskAsync() / executeRalphLoopAsync() in `executor.cjs` — Async task execution methods. Rate limit retry uses `setTimeout` (not busy-wait). ``` ```javascript Pool event handlers in `dispatcher._wirePoolEvents()` — Deliver results, update memory, extract skills when background tasks complete. ``` -------------------------------- ### Interactive File and Line Picker with Preview Source: https://github.com/oimiragieo/agent-studio/blob/main/README.md Uses rg to find lines containing 'auth|token|session' and pipes the output to fzf for interactive selection. The preview window uses 'bat' to display the content of the selected file with syntax highlighting and line numbers. ```powershell rg --line-number --no-heading --color=always "auth|token|session" . | fzf --ansi --delimiter ":" \ --preview "bat --color=always --style=numbers --highlight-line {2} {1}" ``` -------------------------------- ### Directly Trigger Workflow with Slash Command Source: https://github.com/oimiragieo/agent-studio/blob/main/GETTING_STARTED.md When a natural language prompt doesn't trigger a workflow, use a slash command for direct invocation. This example directly triggers the code-quality workflow. ```shell /code-quality # Directly triggers code-quality workflow ``` -------------------------------- ### Agent Manifest Frontmatter Schema Source: https://context7.com/oimiragieo/agent-studio/llms.txt Example YAML frontmatter for an agent file, defining its metadata, capabilities, model, context strategy, and permissions. This schema is required for agent manifest v3.0+. ```yaml # .claude/agents/core/developer.md (frontmatter) --- verified: true lastVerifiedAt: 2026-02-22T19:27:49.887Z name: developer version: 1.1.0 description: >- TDD-focused implementer. Writes code, runs tests, and refactors. Follows Red-Green-Refactor strictly. Uses ripgrep for fast code discovery. model: sonnet temperature: 0.3 context_strategy: lazy_load maxTurns: 18 permissionMode: default isolation: worktree # spawns in git worktree for isolation priority: high tools: - Read - Write - Edit - Glob - Grep - Bash - MemoryRecord - TaskUpdate - Skill skills: - tdd - debugging - code-quality-expert - typescript-expert - react-expert # ... 100+ available skills --- ``` -------------------------------- ### Daemon File Structure Source: https://github.com/oimiragieo/agent-studio/blob/main/scripts/channels/README.md Overview of the daemon's directory structure and key files, including main entry points, configuration, routing, dispatching, rendering, execution, commands, memory, skills, sources, and sinks. ```tree daemon/ ├── index.cjs # Main daemon + HTTP server ├── config.cjs # Config loader ├── router.cjs # Event → route matching ├── dispatcher.cjs # Queue + deliver + tags + rate limit + interviews ├── renderer.cjs # Claude -p + model routing + personality + skill inject ├── executor.cjs # Task/Ralph/Ultrawork execution + rate limit retry ├── commands.cjs # Bot /slash commands (24 commands) ├── memory.cjs # 3-tier KAIROS memory ├── skills.cjs # Skill extraction engine (learns from tasks) ├── sources/ │ ├── telegram.cjs # Telegram polling │ ├── webhook.cjs # Webhook source (POST /webhook) │ └── timer.cjs # KAIROS tick/heartbeat engine └── sinks/ └── telegram.cjs # Telegram delivery (sendMessage + sendDocument) telegram-relay.mjs # MCP server (tools-only in main session) telegram-ctl.cjs # CLI: start/stop/status/restart ``` -------------------------------- ### Create New Test Files Source: https://github.com/oimiragieo/agent-studio/blob/main/scripts/channels/PLAN.md This outlines the file structure for new test files to be created within the `tests/channels/daemon/` directory. These files correspond to specific slices and functionalities. ```bash tests/channels/ ├── daemon/ │ ├── router.test.cjs # Slice 0.1 │ ├── memory.test.cjs # Slice 0.1 │ ├── commands.test.cjs # Slice 0.1 │ ├── dispatcher.test.cjs # Slice 0.1 │ ├── config.test.cjs # Slice 0.1 │ ├── renderer.test.cjs # Slice 1.2, 1.3, 2.3 │ ├── executor.test.cjs # Slice 1.4 │ ├── smoke.test.cjs # Slice 0.2 │ ├── sources/ │ │ └── telegram.test.cjs # Slice 0.1 │ └── sinks/ │ └── telegram.test.cjs # Slice 1.1, 1.2 ``` -------------------------------- ### Integration Smoke Test for Channel Daemon Source: https://github.com/oimiragieo/agent-studio/blob/main/scripts/channels/PLAN.md Integration smoke test file for the channel daemon. This test verifies the daemon's ability to start, process events via HTTP, and report status and health. ```text tests/channels/daemon/smoke.test.cjs ``` -------------------------------- ### Manual Workflow Initialization Source: https://github.com/oimiragieo/agent-studio/blob/main/GETTING_STARTED.md Manually initialize a workflow session by setting a unique WORKFLOW_ID and creating the necessary directory structure for gate files. ```bash WORKFLOW_ID=$(date +%s)-$(uuidgen | cut -d'-' -f1) mkdir -p .claude/context/history/gates/$WORKFLOW_ID ``` -------------------------------- ### Run Quality Daemon Once Source: https://github.com/oimiragieo/agent-studio/blob/main/README.md Execute a single cycle of the Autonomous Quality Daemon. This is useful for testing or performing a one-off quality check. ```bash pnpm quality:daemon:run-once ``` -------------------------------- ### Agent Studio Observability Commands Source: https://context7.com/oimiragieo/agent-studio/llms.txt Utilize these commands for monitoring agent behavior, token consumption, and costs. The session audit provides per-component token burn, and metrics CI gates enforce performance SLOs. ```bash # Inspect per-component token burn for a session pnpm run session:audit # Output: colored table of token consumption by agent/skill/tool # Real-time cost status (written to .claude/context/runtime/ccusage-status.txt): # [tokens] 57,685 today (in: 1,403 / out: 56,282) | Cost: $86.82 # [cache] $316.97 saved | 66,701,262 reads, 7,961,389 writes # [compression] 18 events | 596.2KB freed (~152,627 tokens) | ~$0.76 saved # Pricing table (March 2026): # Model Input Output Cache Write Cache Read # Opus 4.6 $5.00/M $25.00/M $6.25/M $0.50/M # Sonnet 4.6 $3.00/M $15.00/M $3.75/M $0.30/M # Haiku 4.5 $1.00/M $5.00/M $1.25/M $0.10/M # Spend-guard: auto-downgrade sonnet→haiku when ceiling approached SPEND_GUARD_CEILING_USD=5 # per-session ceiling (default $5) SPEND_GUARD=on # set "off" to disable # Context budget pre-flight (blocks spawns that would overflow) SPAWN_BUDGET_DEFAULT_CONTEXT=50000 # warning threshold (tokens) SPAWN_BUDGET_HARD=on # hard-block spawns exceeding 1.6x # Query OpenTelemetry trace spans pnpm run trace:query # DLQ health (dead-letter queue for failed hook events) pnpm run dlq:summary ``` -------------------------------- ### Copy Agent Studio Configuration (PowerShell) Source: https://github.com/oimiragieo/agent-studio/blob/main/GETTING_STARTED.md Clone or download the Agent Studio repository and copy the configuration files to your project directory using Windows PowerShell commands. ```powershell Copy-Item -Path ".claude" -Destination "C:\path\to\your\project\.claude" -Recurse Copy-Item -Path ".claude\CLAUDE.md" -Destination "C:\path\to\your\project\CLAUDE.md" ``` -------------------------------- ### Run Agent Integration Tests Source: https://github.com/oimiragieo/agent-studio/blob/main/GETTING_STARTED.md Execute integration tests for agent framework and ship readiness. These commands verify the end-to-end functionality of your agents. ```bash node .claude/tools/verify-agent-integration.mjs --workflow-id agent-integration-v1- ``` ```bash pnpm ship-readiness:headless:json ``` ```bash node .claude/tools/verify-ship-readiness.mjs --workflow-id ship-readiness-v1- --json ``` -------------------------------- ### Implement Async Renderer with Streaming Source: https://github.com/oimiragieo/agent-studio/blob/main/scripts/channels/PLAN.md Convert the renderer from synchronous `execSync` to asynchronous `execFile` with stdout piping. This allows for real-time streaming of output chunks. ```javascript // renderer.cjs async renderStream(event, onChunk) { // Spawn claude -p as child process // Pipe stdout line by line // Call onChunk(accumulatedText) every ~500ms // Return final text on completion } ```