From 8630cd90a35af537cb94a9475b0e1d3e806a3bd4 Mon Sep 17 00:00:00 2001 From: AIOSAI Date: Fri, 3 Jul 2026 12:18:47 -0700 Subject: [PATCH] config(prompts): configure cli/drone/prax branch prompts (were spawn stubs) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The 3 branches the template checker correctly flagged had never had their .aipass/aipass_local_prompt.md filled in — they booted with a NEEDS CONFIGURATION placeholder and no branch-specific identity. Each branch wrote its own real prompt (identity, key commands, architecture, critical rules, integration points; ~63-67 lines, PROMPT_STYLE.md format). Dispatched @cli/@drone/@prax (each owns its identity); verified independently — 0 stub markers, all three Template 100%, real coherent content. Co-Authored-By: Claude Opus 4.8 (1M context) Claude-Session: https://claude.ai/code/session_013uzDhtcZ6wT1T9e2AHPQig --- CHANGELOG.md | 8 +++ src/aipass/cli/.aipass/aipass_local_prompt.md | 70 +++++++++++++++--- .../drone/.aipass/aipass_local_prompt.md | 72 ++++++++++++++++--- .../prax/.aipass/aipass_local_prompt.md | 68 +++++++++++++++--- 4 files changed, 194 insertions(+), 24 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 43724e59..0837c79b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -52,6 +52,14 @@ Post-2.6.1 cycle — **unreleased** (held for a later merge). unconfigured prompt stubs (cli/drone/prax) still flag. +7 tests (24/24), full suite green. (fixed by @seedgo across 3 dispatched passes, verified by @devpulse) +- **cli / drone / prax branch prompts configured** (were spawn stubs). The three + branches the template checker correctly flagged had never had their + `.aipass/aipass_local_prompt.md` filled in — they booted with a `NEEDS + CONFIGURATION` placeholder and no branch-specific identity. Each branch wrote its + own real prompt (identity, key commands, architecture, critical rules, + integration points; ~63–67 lines, `PROMPT_STYLE.md` format); all three now score + `Template 100%`. (written by @cli/@drone/@prax, dispatched + verified by @devpulse) + ## [2026-07-02] Released as **2.6.1**. Rolls up the DPLAN-0226 / FPLAN-0289 / TDPLAN-0010 / diff --git a/src/aipass/cli/.aipass/aipass_local_prompt.md b/src/aipass/cli/.aipass/aipass_local_prompt.md index 6f4c4b18..ddb1d198 100644 --- a/src/aipass/cli/.aipass/aipass_local_prompt.md +++ b/src/aipass/cli/.aipass/aipass_local_prompt.md @@ -1,11 +1,65 @@ -# CLI Branch-Local Context +# CLI — Branch Prompt + -## Status: NEEDS CONFIGURATION +Shared Rich display and formatting service for all AIPass branches. Provides consistent terminal output — headers, success/error/warning messages, section breaks, operation templates — so every branch renders the same without duplicating formatting code. -Injected into every AI conversation when working this branch directory. Configure: +# Commands -- Branch identity (role, purpose) -- Key commands + workflows -- Architecture overview -- Critical files + operational rules -- Integration points, other branches +``` +drone @cli --help # Full help + architecture overview +drone @cli # Module discovery (introspection) +drone @cli display demo # Display function showcase +drone @cli templates demo # Operation template showcase +``` + +# Public API + +10 symbols exported from `apps/modules/__init__.py`: + - `console`, `err_console` — Rich Console instances (stdout, stderr) + - `header(title, details=None)` — Bordered section header with optional key-value pairs + - `success(message, **kwargs)` — Green checkmark with metadata + - `error(message, suggestion=None)` — Red error with optional suggestion + - `warning(message, details=None)` — Yellow warning with optional details + - `fatal(message, suggestion=None)` — Error then `sys.exit(1)` + - `section(title)` — Visual section separator + - `operation_start(operation, **details)` — Operation begin header + - `operation_complete(**summary)` — Completion summary with timing + +Import: `from aipass.cli import console, header, success, error, warning, section` (top-level, 6 symbols) or `from aipass.cli.apps.modules import ...` (full set, 10 symbols). + +# Architecture + +``` +cli/ +├── __init__.py # Top-level exports (6 symbols) + cli_entry() +├── apps/ +│ ├── cli.py # Entry point (main, route_command) +│ ├── modules/ # PUBLIC — import from here +│ │ ├── display.py # header, success, error, warning, fatal, section +│ │ └── templates.py # operation_start, operation_complete +│ └── handlers/ +│ └── json/ # JSON lifecycle (CRUD, validation, rotation) +└── tests/ # 127 tests across 5 files +``` + +Two-tier design: `apps/modules/` is the public API. `apps/handlers/` is internal — don't import directly. See README for full tree. + +# Critical Rules + + - `apps/modules/` must not import `aipass.prax` — circular dependency (prax depends on cli). Bypassed in `.seedgo/bypass.json`. + - `json_handler.py` must not import prax either — same circular chain. Callers log via prax. + - Import json_handler as module: `from aipass.cli.apps.handlers.json import json_handler` then `json_handler.log_operation(...)`. Seedgo AST checker matches this exact pattern. + - `error()` suggestion param must not include "Try:" prefix — `display.py` adds it automatically. + - `handle_command()` accepts both direct command (`command='init'` from PATH) and prefixed command (`command='aipass'` from drone). Both paths must stay wired. + +# Integration Points + + - Depends on: `rich` (formatting), `aipass.prax` (logging, in cli.py only), Python stdlib + - Provides to: all branches — display functions, operation templates, Rich console access + - Cannot import in modules/: `aipass.prax` — see bypass rules above + +# Entry Points + + - `drone @cli [command]` — routes to `apps/cli.py:main()` + - `python -m aipass.cli` — `__main__.py` calls `main()` + - `aipass` on PATH — console_scripts via `cli_entry()` in `__init__.py` diff --git a/src/aipass/drone/.aipass/aipass_local_prompt.md b/src/aipass/drone/.aipass/aipass_local_prompt.md index 529b9f7d..51516a9f 100644 --- a/src/aipass/drone/.aipass/aipass_local_prompt.md +++ b/src/aipass/drone/.aipass/aipass_local_prompt.md @@ -1,11 +1,67 @@ -# DRONE Branch-Local Context +# DRONE — Branch Prompt + -## Status: NEEDS CONFIGURATION +Command router and symbolic addressing for AIPass. Resolves `@branch` names to paths, routes commands to entry points, and owns all git operations behind a tier-based access system. The only git interface in the system — raw git/gh is blocked by hooks. -Injected into every AI conversation when working this branch directory. Configure: +# Commands -- Branch identity (role, purpose) -- Key commands + workflows -- Architecture overview -- Critical files + operational rules -- Integration points, other branches +``` +drone @branch command args # Route command to any branch +drone @branch # No-args introspection (what a branch IS) +drone @branch --help # Full usage reference +drone systems # List all registered branches and modules +drone @git status / diff / log # Read-only git (all branches) +drone @git commit / pr / sync # Write git (devpulse only) +drone scan @branch # Discover available commands +drone activate @branch # Register command shortcuts +``` + +Full command list: `drone --help` or README. + +# Architecture + +Three routing paths, checked in order: + + - Built-in commands: `systems`, `scan`, `activate`, `list`, `remove` — handled directly in `drone.py`. + - `@target` routing: resolve via `AIPASS_REGISTRY.json` → subprocess dispatch. Interactive commands (monitor, audit, watchdog, status, bare introspection, --help) inherit the terminal for Rich output. + - Module fallback: internal modules (`git`) via importlib, external modules (`seedgo`, `cli`, `spawn`) via `generic_adapter` and `routing_config.json`. + +``` +apps/ +├── drone.py # Core entry + CLI routing +├── modules/ # Orchestrators: resolver, router, git_module, commands, scan +├── handlers/ # Implementation: executor, registry, discovery, git/, broker/ +└── plugins/devpulse_ops/ # Auth-gated write operations (PR, merge, sync, fix) +``` + +Full tree and details in README. + +# Git Tier System + +Auth checked once at top of `git_module.handle_command()` via `verify_git_access()`. + + - Global tier (all branches): `status`, `diff`, `log`, `lock`, `branches`, `tag --list`, `issue`, `run`, `workflow`. + - Owner tier (devpulse only): `commit`, `pr`, `dev-pr`, `merge`, `checkout`, `sync`, `smart-sync`, `delete-branch`, `close-pr`, `unlock`, `fix`, `tag`. + +Three enforcement layers: hooks block raw git/gh, drone tier restricts write commands, prompt instructions tell agents they have no git access. + +# Critical Files + + - `apps/drone.py` — entry point, routing decision tree, interactive command lists. + - `apps/modules/git_module.py` — git orchestrator, tier dispatch, adapter for `_MODULE_REGISTRY`. + - `apps/plugins/devpulse_ops/auth.py` — passport-based identity gate, `ALLOWED_CALLERS` list. + - `apps/handlers/registry_handler.py` — dual registry lookup (local project + `AIPASS_HOME` fallback). + - `apps/handlers/executor.py` — safe subprocess execution (no shell, timeout, capture). + +# Operational Rules + + - Module routing captures output (dicts). Branch routing can inherit TTY. Commands needing live terminal (Rich progress, TUI) must be in `INTERACTIVE_COMMANDS` or `INTERACTIVE_BRANCHES` — checked before `is_module()`. + - Routed command output uses `sys.stdout.write()`, not `console.print()`. Rich wraps at 80 cols when piped. + - Branch detection uses `.trinity/` marker walk-up, not hardcoded paths. `detect_caller_branch_name()` with `AIPASS_BRANCH_NAME` env var fallback. + - External project support: dual registry merges local + AIPASS_HOME registries. Local entries win on collision. + +# Integration Points + + - Depends on: `AIPASS_REGISTRY.json` (branch resolution), `gh` CLI (GitHub ops), `.trinity/passport.json` (auth). + - Provides to: every branch — command routing, module/branch discovery, git workflows. + - Dev branch model: all work on `dev`, only devpulse commits. `dev-pr` pushes dev → PR to main. diff --git a/src/aipass/prax/.aipass/aipass_local_prompt.md b/src/aipass/prax/.aipass/aipass_local_prompt.md index 62de1078..761b7147 100644 --- a/src/aipass/prax/.aipass/aipass_local_prompt.md +++ b/src/aipass/prax/.aipass/aipass_local_prompt.md @@ -1,11 +1,63 @@ -# PRAX Branch-Local Context +# PRAX — Branch Prompt + -## Status: NEEDS CONFIGURATION +The logging and monitoring backbone. Every branch logs through prax — `from aipass.prax import logger`. Also provides real-time Mission Control, dashboard infrastructure, and log audit. -Injected into every AI conversation when working this branch directory. Configure: +# Commands -- Branch identity (role, purpose) -- Key commands + workflows -- Architecture overview -- Critical files + operational rules -- Integration points, other branches +``` +drone @prax # Self-map (discovered modules) +drone @prax monitor run # Launch Mission Control (all branches) +drone @prax monitor run seedgo,cli # Monitor specific branches +drone @prax dashboard refresh --all # Refresh all branch dashboards +drone @prax dashboard refresh @flow # Refresh a specific branch +drone @prax log-audit audit # Scan system_logs/ health +drone @prax log-audit enforce # Truncate oversized logs +drone @prax status # System health +drone @prax --help # Full command reference +``` + +# Architecture + + - `apps/prax.py` — entry point. Auto-discovers modules in `apps/modules/`, routes commands. Zero business logic. + - `apps/modules/` — 5 command modules: `logger`, `monitor`, `dashboard`, `status`, `log_audit`. Each a thin orchestrator over its handlers. + - `apps/handlers/` — 11 handler directories. Implementation details, never imported by external branches. + - `prax_json/` — auto-created per-module config/data/log files. + - `templates/` — dashboard template schema (`DASHBOARD.template.json`). + - Full tree in README. + +# Logging System + + - Canonical import: `from aipass.prax import logger`. Works from any branch. + - Direct logger: `from aipass.prax.apps.modules.logger import get_direct_logger` — for prax internals in watchdog threads or import chain. + - Auto-routing via stack introspection: detects caller's module, branch, file path. + - Two-tier placement: `system_logs/_.log` (central) + `/logs/.log` (local). + - Self-healing: auto-creates missing dirs, warns on fallback, never crashes the caller. + - Env var override: `AIPASS_LOG_NAME` or `AIPASS_BOT_ID` checked before stack walk for shared-base-class disambiguation. + - External project routing: projects outside AIPass get their own `system_logs/` + `logs/` under their project root. + +# Critical Rules + + - Prax is the only logging system. No branch runs its own logging setup. + - Prax is infrastructure only — no application logic. + - No cross-branch file edits. Issue in another branch's code? Email the owner. + - Handlers are internal — external branches import only from `aipass.prax` or `aipass.prax.apps.modules.*`. + - Dashboard files are auto-generated (`DASHBOARD.local.json`). Services update via `write_section()` API or central file refresh. + +# Monitor — Mission Control + + - 3-thread architecture: display worker, file watcher (watchdog), log watcher (tails system_logs). + - Multi-CLI: monitors Claude Code JSONL and Codex JSONL sessions. Model tags + caller attribution. + - Polling fallback when inotify watches are exhausted. + - Soft start: seeks to EOF, only shows new activity after launch. + +# Integration Points + + - All branches log through `from aipass.prax import logger`. + - Dashboard refresh reads `*.central.json` from `.ai_central/` (managed by ai_mail, flow). + - Depends on: `aipass.cli` (formatting), `aipass.drone` (caller markers), `watchdog` (filesystem events). + - `drone @prax dashboard push-template` syncs template schema to all branches. + +# Tests + +901 tests across 19 files. Run with `pytest tests/` from branch root. See README for per-file breakdown.