diff --git a/.aipass/.gitignore b/.aipass/.gitignore new file mode 100644 index 00000000..67d45f81 --- /dev/null +++ b/.aipass/.gitignore @@ -0,0 +1,3 @@ +* +!aipass_global_prompt.md +!.gitignore diff --git a/.aipass/aipass_global_prompt.md b/.aipass/aipass_global_prompt.md index da4705ca..fd882a5a 100644 --- a/.aipass/aipass_global_prompt.md +++ b/.aipass/aipass_global_prompt.md @@ -27,7 +27,7 @@ Every branch follows the same structure: ``` src/aipass/{name}/ ├── .trinity/ # Identity & memory (passport.json, local.json, observations.json) -├── .aipass/ # System prompt (branch_system_prompt.md) +├── .aipass/ # System prompt (aipass_local_prompt.md) ├── .ai_mail.local/ # Mailbox (inbox.json, sent/) ├── apps/ │ ├── {name}.py # Entry point (e.g. spawn.py, prax.py, drone.py) @@ -35,6 +35,8 @@ src/aipass/{name}/ │ └── handlers/ # Implementation details ├── logs/ # Prax log output └── README.md + +~/.secrets/aipass/ # API keys, tokens, credentials (outside repo, cross-platform) ``` **15 branches:** drone, seedgo, prax, cli, flow, ai_mail, api, trigger, spawn, devpulse, backup, daemon, memory, commons, skills @@ -79,6 +81,7 @@ from aipass.prax import logger - **No hardcoded paths.** Use `Path(__file__).parents[N]` or drone for resolution. - **No deleting files.** Move to `.archive/` or rename with `(disabled)`. - **Verify after fixing.** Run a test or command to confirm. Don't say "fixed" until verified. +- **Cross-platform.** AIPass is a public package — code must work on Linux, macOS, and Windows. Use `pathlib.Path` not string concatenation. Use `Path.home()` not `~` or `/home/`. Secrets live at `~/.secrets/aipass/` (`Path.home() / ".secrets" / "aipass"`). ## Memories diff --git a/.claude/hooks/branch_prompt_loader.py b/.claude/hooks/branch_prompt_loader.py index 88b8ef9f..07608bcf 100644 --- a/.claude/hooks/branch_prompt_loader.py +++ b/.claude/hooks/branch_prompt_loader.py @@ -3,7 +3,7 @@ Branch Prompt Loader — AIPass Public Repo Injects branch-specific prompts based on CWD. When working in a branch -directory, loads .aipass/branch_system_prompt.md and outputs it so the +directory, loads .aipass/aipass_local_prompt.md and outputs it so the AI sees branch-specific context. Version: 1.0.0 @@ -41,7 +41,7 @@ def main(): branch_root = find_branch_root() if branch_root: - prompt_file = branch_root / ".aipass" / "branch_system_prompt.md" + prompt_file = branch_root / ".aipass" / "aipass_local_prompt.md" if prompt_file.exists(): content = prompt_file.read_text().strip() branch_name = branch_root.name.upper() diff --git a/pyproject.toml b/pyproject.toml index 93762cc8..235291b9 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -45,6 +45,7 @@ dev = [ "pytest-cov", "ruff", "coverage", + "pyright", ] [project.scripts] diff --git a/setup.sh b/setup.sh index 53075e93..1cf89006 100755 --- a/setup.sh +++ b/setup.sh @@ -68,6 +68,17 @@ else FAIL=1 fi +# --- Create secrets directory --- +SECRETS_DIR="$HOME/.secrets/aipass" +if [ ! -d "$SECRETS_DIR" ]; then + echo "Creating secrets directory at $SECRETS_DIR ..." + mkdir -p "$SECRETS_DIR" + chmod 700 "$HOME/.secrets" + echo " ~/.secrets/aipass/ ... created" +else + echo "Secrets directory already exists — skipping" +fi + # --- Generate branch registry --- if [ ! -f "AIPASS_REGISTRY.json" ]; then echo "Generating AIPASS_REGISTRY.json ..." diff --git a/src/aipass/backup/.aipass/branch_system_prompt.md b/src/aipass/backup/.aipass/branch_system_prompt.md deleted file mode 100644 index e7acf95b..00000000 --- a/src/aipass/backup/.aipass/branch_system_prompt.md +++ /dev/null @@ -1,14 +0,0 @@ -# BACKUP Branch-Local Context - - -> Auto-created by aipass init. Customize for your branch. - -## Status: NEEDS CONFIGURATION - -This file is injected into every AI conversation when working from this branch directory. Configure it with: - -- Who this branch is (role, purpose) -- Key commands and workflows -- Architecture overview -- Critical files and operational rules -- Integration points with other branches diff --git a/src/aipass/backup/apps/handlers/json/json_handler.py b/src/aipass/backup/apps/handlers/json/json_handler.py index 5d0f8b13..091e6b99 100755 --- a/src/aipass/backup/apps/handlers/json/json_handler.py +++ b/src/aipass/backup/apps/handlers/json/json_handler.py @@ -24,7 +24,7 @@ from datetime import datetime from typing import Dict, Any, Optional # Constants -_BACKUP_ROOT = Path(__file__).resolve().parents[4] # src/aipass/backup/ +_BACKUP_ROOT = Path(__file__).resolve().parents[3] # src/aipass/backup/ BACKUP_JSON_DIR = _BACKUP_ROOT / "backup_json" JSON_TEMPLATES_DIR = Path(__file__).resolve().parents[2] / "json_templates" diff --git a/src/aipass/backup/apps/handlers/operations/drive_sync_client.py b/src/aipass/backup/apps/handlers/operations/drive_sync_client.py index 99654491..160cbf6e 100644 --- a/src/aipass/backup/apps/handlers/operations/drive_sync_client.py +++ b/src/aipass/backup/apps/handlers/operations/drive_sync_client.py @@ -74,7 +74,7 @@ from aipass.backup.apps.handlers.json.drive_sync_json import ( # CONSTANTS # ============================================= -_BACKUP_ROOT = Path(__file__).resolve().parents[4] # src/aipass/backup/ +_BACKUP_ROOT = Path(__file__).resolve().parents[3] # src/aipass/backup/ JSON_DIR = _BACKUP_ROOT / "backup_json" SCOPES = ['https://www.googleapis.com/auth/drive.file'] diff --git a/src/aipass/backup/apps/handlers/operations/drive_sync_ops.py b/src/aipass/backup/apps/handlers/operations/drive_sync_ops.py index a9a407b1..f1f55242 100644 --- a/src/aipass/backup/apps/handlers/operations/drive_sync_ops.py +++ b/src/aipass/backup/apps/handlers/operations/drive_sync_ops.py @@ -36,7 +36,7 @@ from aipass.backup.apps.handlers.json.drive_sync_json import ( ) # JSON file paths (resolved relative to backup root) -_BACKUP_ROOT = Path(__file__).resolve().parents[4] # src/aipass/backup/ +_BACKUP_ROOT = Path(__file__).resolve().parents[3] # src/aipass/backup/ _JSON_DIR = _BACKUP_ROOT / "backup_json" _MODULE_NAME = "google_drive_sync" _CONFIG_FILE = _JSON_DIR / f"{_MODULE_NAME}_config.json" diff --git a/src/aipass/backup/apps/handlers/utils/backup_timestamps.py b/src/aipass/backup/apps/handlers/utils/backup_timestamps.py index 5c72e668..8b1becd2 100644 --- a/src/aipass/backup/apps/handlers/utils/backup_timestamps.py +++ b/src/aipass/backup/apps/handlers/utils/backup_timestamps.py @@ -25,7 +25,7 @@ import json from pathlib import Path from datetime import datetime -_BACKUP_ROOT = Path(__file__).resolve().parents[4] # src/aipass/backup/ +_BACKUP_ROOT = Path(__file__).resolve().parents[3] # src/aipass/backup/ TIMESTAMPS_FILE = _BACKUP_ROOT / "backup_data" / "backup_timestamps.json" MODES = ["snapshot", "versioned", "drive_sync"] diff --git a/src/aipass/daemon/.aipass/branch_system_prompt.md b/src/aipass/daemon/.aipass/branch_system_prompt.md deleted file mode 100644 index a6aa1c72..00000000 --- a/src/aipass/daemon/.aipass/branch_system_prompt.md +++ /dev/null @@ -1,14 +0,0 @@ -# DAEMON Branch-Local Context - - -> Auto-created by aipass init. Customize for your branch. - -## Status: NEEDS CONFIGURATION - -This file is injected into every AI conversation when working from this branch directory. Configure it with: - -- Who this branch is (role, purpose) -- Key commands and workflows -- Architecture overview -- Critical files and operational rules -- Integration points with other branches diff --git a/src/aipass/daemon/apps/handlers/actions/actions_registry.py b/src/aipass/daemon/apps/handlers/actions/actions_registry.py index 5d965b78..46000df4 100644 --- a/src/aipass/daemon/apps/handlers/actions/actions_registry.py +++ b/src/aipass/daemon/apps/handlers/actions/actions_registry.py @@ -43,7 +43,7 @@ from typing import Optional logger = logging.getLogger(__name__) # Paths -_DAEMON_ROOT = Path(__file__).resolve().parents[4] # src/aipass/daemon/ +_DAEMON_ROOT = Path(__file__).resolve().parents[3] # src/aipass/daemon/ REGISTRY_FILE = _DAEMON_ROOT / "daemon_json" / "actions_registry.json" PLUGINS_DIR = _DAEMON_ROOT / "apps" / "plugins" diff --git a/src/aipass/daemon/apps/handlers/json/json_handler.py b/src/aipass/daemon/apps/handlers/json/json_handler.py index 0b784b0c..c6801ebc 100644 --- a/src/aipass/daemon/apps/handlers/json/json_handler.py +++ b/src/aipass/daemon/apps/handlers/json/json_handler.py @@ -29,7 +29,7 @@ from typing import Dict, List, Any, Optional import inspect # Constants -_DAEMON_ROOT = Path(__file__).resolve().parents[4] # src/aipass/daemon/ +_DAEMON_ROOT = Path(__file__).resolve().parents[3] # src/aipass/daemon/ JSON_DIR = _DAEMON_ROOT / "daemon_json" JSON_TEMPLATES_DIR = _DAEMON_ROOT / "apps" / "json_templates" diff --git a/src/aipass/daemon/apps/handlers/schedule/task_registry.py b/src/aipass/daemon/apps/handlers/schedule/task_registry.py index 5a488c13..2cdcc7bf 100644 --- a/src/aipass/daemon/apps/handlers/schedule/task_registry.py +++ b/src/aipass/daemon/apps/handlers/schedule/task_registry.py @@ -33,7 +33,7 @@ import re # CONSTANTS # ============================================= -_DAEMON_ROOT = Path(__file__).resolve().parents[4] # src/aipass/daemon/ +_DAEMON_ROOT = Path(__file__).resolve().parents[3] # src/aipass/daemon/ SCHEDULE_JSON_PATH = _DAEMON_ROOT / "daemon_json" / "schedule.json" DEFAULT_SCHEDULE_DATA: Dict[str, Any] = { diff --git a/src/aipass/daemon/apps/handlers/telegram/assistant_chat.py b/src/aipass/daemon/apps/handlers/telegram/assistant_chat.py index 2d282d36..ed1295f3 100755 --- a/src/aipass/daemon/apps/handlers/telegram/assistant_chat.py +++ b/src/aipass/daemon/apps/handlers/telegram/assistant_chat.py @@ -34,7 +34,7 @@ except ImportError: TELEGRAM_CHAT_AVAILABLE = False run_direct_chat = None -_DAEMON_ROOT = Path(__file__).resolve().parents[4] # src/aipass/daemon/ +_DAEMON_ROOT = Path(__file__).resolve().parents[3] # src/aipass/daemon/ if not TELEGRAM_CHAT_AVAILABLE: print("[assistant_chat] telegram_chat module not available, exiting") diff --git a/src/aipass/daemon/apps/handlers/update/data_loader.py b/src/aipass/daemon/apps/handlers/update/data_loader.py index bb59a101..143be602 100644 --- a/src/aipass/daemon/apps/handlers/update/data_loader.py +++ b/src/aipass/daemon/apps/handlers/update/data_loader.py @@ -26,7 +26,7 @@ from typing import Dict, Any, List # CONSTANTS # ============================================= -_DAEMON_ROOT = Path(__file__).resolve().parents[4] # src/aipass/daemon/ +_DAEMON_ROOT = Path(__file__).resolve().parents[3] # src/aipass/daemon/ INBOX_PATH = _DAEMON_ROOT / "ai_mail.local" / "inbox.json" LOCAL_PATH = _DAEMON_ROOT / "DAEMON.local.json" diff --git a/src/aipass/devpulse/.aipass/.archive_old_local_prompt.md b/src/aipass/devpulse/.aipass/.archive_old_local_prompt.md new file mode 100644 index 00000000..4b5ca2eb --- /dev/null +++ b/src/aipass/devpulse/.aipass/.archive_old_local_prompt.md @@ -0,0 +1,61 @@ +# DEVPULSE Branch-Local Context + +You are DEVPULSE — the orchestration hub for the AIPass public repo. + +## What You Are + +You are to AIPass what DEV_CENTRAL is to Dev-Pass. You coordinate, plan, delegate, and track. You don't build modules yourself — you dispatch work to branch agents and monitor results. + +**Your role:** +- System-wide planning and coordination for AIPass repo +- Cross-branch task delegation via email + agents +- Dev notes management (dev.local.md per branch) +- Dashboard and system status tracking +- Architecture discussions with Patrick + +## Key Context + +- **AIPass repo:** `/home/aipass/aipass_business/AIPass/` (or `/app` in Docker) +- **Your directory:** `src/aipass/devpulse/` +- **Registry:** `AIPASS_REGISTRY.json` at repo root +- **10 modules:** drone, seedgo, prax, cli, flow, ai_mail, api, trigger, spawn, devpulse (you) + +## Commands + +``` +drone systems # List all registered modules +drone @seedgo verify # Verify standards packs +drone @seedgo audit aipass # Run standards audit +drone @module --help # Module help +``` + +## Your Workflow + +1. Check your memories (.trinity/local.json, observations.json) +2. Check system status (drone systems, seedgo verify) +3. Review what needs building (MPLAN-001 tracks all module status) +4. Dispatch work to branches or build directly if small +5. Update memories after every session + +## Architecture + +All modules follow 3-layer pattern: +``` +apps/ + branch.py # Entry point + modules/ # Business logic + handlers/ # Implementation +``` + +Imports use pip namespace: `from aipass.{module}.apps.modules...` + +## Critical Rules + +- Imports must use `from aipass.{module}...` — never bare module imports +- No hardcoded paths to `/home/aipass/` — use `Path(__file__).parents[N]` or registry +- Test in Docker container for true isolation verification +- `drone` and `seedgo` are CLI entry points defined in pyproject.toml + +## Current State + +Fresh spawn. All modules are in "building" status — imports rewired but functionality not fully tested. Docker container at localhost:8080 is your testing ground. diff --git a/src/aipass/devpulse/.aipass/branch_system_prompt.md b/src/aipass/devpulse/.aipass/aipass_local_prompt.md similarity index 80% rename from src/aipass/devpulse/.aipass/branch_system_prompt.md rename to src/aipass/devpulse/.aipass/aipass_local_prompt.md index b4df1f27..ac89ca60 100644 --- a/src/aipass/devpulse/.aipass/branch_system_prompt.md +++ b/src/aipass/devpulse/.aipass/aipass_local_prompt.md @@ -95,6 +95,8 @@ You are a **manager**, not a worker. Delegate code tasks to sub-agents — don't **Use background agents aggressively.** When multiple independent tasks exist, spawn background agents to handle them in parallel. Don't wait for one task to finish before starting the next. Keep the pipeline moving. +- When waiting on background agents, stay engaged — don't idle. Start next tasks, check inbox, update memories. + ## Critical Rules - Imports must use `from aipass.{module}...` — never bare module imports @@ -102,3 +104,21 @@ You are a **manager**, not a worker. Delegate code tasks to sub-agents — don't - `drone` and `seedgo` are CLI entry points defined in pyproject.toml - No cross-branch file edits — email the branch if you find an issue - Dev-Pass is at `/home/patrick/Projects/Dev-Pass/` — reference only, not source + +## Current Context (Session 13) + +**Date:** 2026-03-08 + +- 20-standard audit complete — all 20 NEEDS UPDATE, zero compliant +- FPLAN-0010 created for standards fixes +- 3 checker bugs fixed: encapsulation continue/break, error_handling import match, cli import prefix +- AIPass header regex fixed (META→AIPass) across 42 checker files +- Checker paths fixed in 10 docs +- parents[4]→parents[3] fixed in 1 doc + 16 code files (backup/daemon/memory) +- Prax import standard updated to accept both canonical and shorthand forms +- Bypass.json mechanism exists but is unpopulated — needed for branch audits +- Permission flags standard is future-proofing placeholder +- Logs layout needs discussion with Patrick +- 4 modules completely non-compliant with prax logging: backup (12 files), daemon (12), memory (16), drone (2) +- drone.py uses 41 bare print() calls, needs CLI service migration +- backup/daemon/memory bypass CLI service with local Console() diff --git a/src/aipass/devpulse/docs/DPLAN-0001_system_bootstrap.md b/src/aipass/devpulse/docs/DPLAN-0001_system_bootstrap.md index 49484d8b..f27436c9 100644 --- a/src/aipass/devpulse/docs/DPLAN-0001_system_bootstrap.md +++ b/src/aipass/devpulse/docs/DPLAN-0001_system_bootstrap.md @@ -8,15 +8,15 @@ Tag: bootstrap Every module has citizenship (.trinity/), can receive email, and can be woken via dispatch. DevPulse has full visibility. The system runs as a coordinated multi-agent team. ## Current State -- All 15 branches registered and discoverable via `drone systems` -- All 5 new citizens granted birthright citizenship -- Registry cleaned of stale test entries (manually — sync-registry can't detect /tmp dirs that still exist) -- 13/15 branches respond to `drone @branch --help` (devpulse has no apps/ by design, commons needs DB init fix) -- Backup, daemon import fixes complete (relative → absolute) -- Skills import fixes complete + __main__ block added +- All 15 branches registered, discoverable, and fully scaffolded +- All citizens are builder class (except devpulse = manager) +- 13/15 respond to `drone @branch --help` (devpulse has no apps/ by design, commons DB init fails) +- Import fixes complete: backup (16 files), daemon (8 files), skills (5 files) - Commons entry point renamed (the_commons.py → commons.py) -- Wake dispatch tested on @memory — agent spawned successfully -- Tests need --isolate-registry flag or mock to stop polluting live registry +- Wake + round-trip comms verified on @memory and @backup +- Seedgo audit: all branches passing (77-98%) +- gh CLI installed and authed for PR workflow +- 3 PRs merged: #17 (bootstrap), #18 (builder scaffold), #19 (commons/skills scaffold) ## What Needs Building @@ -63,6 +63,8 @@ Every module has citizenship (.trinity/), can receive email, and can be woken vi | commons/skills location | Move to src/aipass/ vs keep outside | Keep outside | They're not aipass system apps, they're external projects with their own namespace | | Citizenship for existing code | spawn create vs spawn passport | passport | Passport adds .trinity/ without touching apps/ | | Registry cleanup | Manual vs sync-registry --fix | sync-registry --fix | Let spawn's built-in tool handle it | +| Citizen class for ported code | birthright vs builder | builder | All branches with apps/ should be builder — birthright is for identity-only | +| External project scaffolding | spawn update vs manual | manual | spawn update can't reach outside src/aipass/, copy template files manually | ## Relationships - **Related DPLANs:** None yet @@ -79,9 +81,11 @@ Every module has citizenship (.trinity/), can receive email, and can be woken vi ## Notes Session 11. First DPLAN in AIPass. Patrick confirmed: commons and skills are NOT aipass system apps — they live outside src/aipass/ intentionally. Use spawn passport for existing directories to avoid clobbering code. -**Progress:** Phases 1-3 complete. All 15 branches discoverable, 13/15 responding to --help. Phase 4 in progress — wake tested on @memory, agent spawned. Phase 5 partial — devpulse prompt and passport updated, global prompt updated, 5 new citizens still need local prompts. 300 tests passing. +**Progress:** Phases 1-4 substantially complete. All 15 branches scaffolded as builder class. Wake + round-trip comms verified on @memory and @backup. Phase 5 partial — prompts need building for new citizens. -**Session 12 additions:** Fixed skills (added __main__ + absolute imports), fixed commons routing (renamed entry point), cleaned registry stale entries manually, tested wake dispatch on @memory. Tests pollute registry — needs isolation fix in spawn tests. +**Session 12:** Fixed skills (added __main__ + absolute imports), fixed commons routing (renamed entry point), cleaned registry stale entries manually, tested wake dispatch on @memory and @backup — both replied autonomously. Discovered passport was setting birthright instead of builder — fixed all 5, ran spawn update on backup/daemon/memory, manually scaffolded commons/skills. Installed gh CLI. PRs #17, #18, #19 merged. + +**Remaining:** Commons DB init fix, ai_mail inbox display bug, branch prompts for new citizens, test registry isolation. --- *Created: 2026-03-07* diff --git a/src/aipass/flow/FPLAN-0010_fix_seedgo_standards_3_checker_bugs_doc__2026-03-08.md b/src/aipass/flow/FPLAN-0010_fix_seedgo_standards_3_checker_bugs_doc__2026-03-08.md new file mode 100644 index 00000000..ed4d6b62 --- /dev/null +++ b/src/aipass/flow/FPLAN-0010_fix_seedgo_standards_3_checker_bugs_doc__2026-03-08.md @@ -0,0 +1,514 @@ +# FPLAN-0010 - Fix seedgo standards: 3 checker bugs, doc paths, header regex (MASTER PLAN) + +**Created**: 2026-03-08 +**Branch**: flow +**Status**: Active +**Type**: Master Plan (Multi-Phase) + +--- + +## What Are Flow Plans? + +Flow Plans (FPLANs) are for **BUILDING** - autonomous construction of systems, features, modules. They're the structured way to execute work without constant human oversight. + +**This is NOT for:** +- Research or exploration (use agents directly) +- Quick fixes (just do it) +- Discussion or planning (that happens before creating the FPLAN) + +**This IS for:** +- Building new branches/modules +- Implementing features +- Multi-phase construction projects +- Autonomous execution + +--- + +## Master Plan vs Default Plan + +| | Master Plan | Default Plan | +|---|-------------|--------------| +| **Use when** | 3+ phases, complex build | Single focused task | +| **Structure** | Roadmap + sub-plans | Self-contained | +| **Phases** | Multiple, sequential | One | +| **Sub-plans** | Yes, one per phase | No | +| **Typical use** | Build entire branch | One phase of master | + +**Pattern:** +``` +Master Plan (roadmap) +├── Sub-plan Phase 1 (default template) +├── Sub-plan Phase 2 (default template) +├── Sub-plan Phase 3 (default template) +└── Sub-plan Phase 4 (default template) +``` + +**How to start:** +1. The user provides planning doc or instructions (coordinate with @devpulse) +2. Branch manager reads and understands scope +3. Branch manager creates master plan: `drone @flow create . "Build X" master` +4. Branch manager fills in phases, then executes autonomously + +--- + +## Critical: Branch Manager Role + +**You are the ORCHESTRATOR, not the builder.** + +Your 200k context is precious. Burning it on file reads and code writing risks compaction during autonomous work. Agents have clean context - use them for ALL building. + +| You Do (Orchestrator) | Agents Do (Builders) | +|-----------------------|----------------------| +| Create plans & sub-plans | Write code | +| Define phases | Run tests | +| Give agent instructions | Read/modify files | +| Review agent output | Research/exploration | +| Course correct | Heavy lifting | +| Update memories | Single-task execution | +| Send status emails | Build deliverables | +| Track phase progress | Quality checks on code | + +**Master Plan Pattern:** Define all phases → Create sub-plan for Phase 1 → Deploy agent → Review → Close sub-plan → Email update → Next phase + +--- + +## Seek Branch Expertise + +Don't figure everything out alone. Other branches are domain experts - ask them first. + +**Before building anything that touches another branch's domain:** +```bash +ai_mail send @branch "Question: [topic]" "I'm working on X and need guidance on Y. What's the best approach?" +``` + +**Common examples:** +- Building something with email? Ask @ai_mail how delivery works +- Need routing or @ resolution? Ask @drone +- Unsure about standards? Ask @seedgo for reference code +- Need persistent storage or search? Ask @memory_bank +- Event-driven behavior? Ask @trigger about their event system +- Dashboard integration? Ask @devpulse about update_section() + +They have deep memory on their systems. A 1-email question saves you hours of guessing. For master plans spanning multiple domains, identify which branches to consult during phase definitions. + +--- + +## Notepad + +Keep `notepad.md` in your branch directory as a shared scratchpad during the build. Use it for: +- **Status updates** - Quick progress lines so the user can glance without asking +- **Questions for the user** - Non-urgent questions that can wait for the next check-in +- **Notes to self** - Decisions made, things to revisit, gotchas discovered + +Update it as you work - lightweight, not formal. The user checks it when they want to, skips it when busy. Low friction both ways. + +```bash +# Create it at plan start +echo "# Notepad - FPLAN-0010" > notepad.md +``` + +--- + +## Command Reference + +When unsure about syntax, use `--help`: + +```bash +# Flow - Plan management +drone @flow create . "Phase X: subject" # Create sub-plan (. = current dir) +drone @flow create . "subject" master # Create master plan +drone @flow close FPLAN-XXXX # Close plan +drone @flow list # List active plans +drone @flow status # Plan status +drone @flow --help # Full help + +# Seedgo - Quality gates +drone @seedgo checklist # 10-point check on file +drone @seedgo audit @branch # Full branch audit (before master close) +drone @seedgo --help # Full help + +# AI_Mail - Status updates +drone @ai_mail send @devpulse "Subject" "Message" +drone @ai_mail inbox # Check your inbox +drone @ai_mail --help # Full help + +# Discovery +drone systems # All available modules +drone list @branch # Commands for branch +``` + +--- + +## What is a Master Plan? + +Master Plans are for **complex multi-phase projects**. You define all phases upfront, then create focused sub-plans for each phase. + +**When to use:** +- 3+ distinct sequential phases +- Work spanning multiple sessions +- Need clear phase completion milestones +- Complex builds requiring sustained focus + +**Pattern:** Master Plan = Roadmap | Sub-Plans = Focused Execution + +--- + +## Project Overview + +### Goal +[What is the end state when ALL phases complete?] + +### Reference Documentation +[List planning docs, specs, existing code to reference] + +### Success Criteria +[What defines DONE for the entire project?] + +--- + +## Branch Directory Structure + +Every branch has dedicated directories. Use them correctly: + +``` +branch/ +├── apps/ # Code (modules/, handlers/) +├── tests/ # All test files go here +├── tools/ # Utility scripts, helpers +├── artifacts/ # Agent outputs (reports, logs) +├── docs/ # Documentation +└── logs/ # Execution logs +``` + +**Rules:** +- Tests → `tests/` (not root, not random locations) +- Tools/scripts → `tools/` +- Agent artifacts → `artifacts/` +- Create subdirs if needed: `mkdir -p artifacts/reports artifacts/logs` +- **Never delete** - devpulse manages cleanup +- Future: artifacts auto-roll to Memory Bank + +--- + +## Phase Definitions + +Define ALL phases before starting work: + +### Phase 1: [Name] +**Goal:** [What this phase accomplishes] +**Agent Task:** [What the agent will build] +**Deliverables:** [Files/outputs expected] + +### Phase 2: [Name] +**Goal:** [What this phase accomplishes] +**Agent Task:** [What the agent will build] +**Deliverables:** [Files/outputs expected] + +### Phase 3: [Name] +**Goal:** [What this phase accomplishes] +**Agent Task:** [What the agent will build] +**Deliverables:** [Files/outputs expected] + +### Phase 4: [Name] +**Goal:** [What this phase accomplishes] +**Agent Task:** [What the agent will build] +**Deliverables:** [Files/outputs expected] + +[Add more phases as needed] + +--- + +## Execution Philosophy + +### Autonomous Power-Through + +Master plans are for **autonomous execution**. Don't halt production every phase waiting for review. + +**The Pattern:** +- Power through all phases +- Accumulate issues as you go +- Deal with issues at the end +- The user reviews the final result, not every step + +**Why this works:** +- Context is precious - don't burn it chasing bugs +- Complete picture reveals which issues actually matter +- Many "bugs" resolve themselves when later phases complete +- Coordination time is for decisions, not babysitting + +### The 2-Attempt Rule + +When agent encounters an issue: + +``` +Attempt 1 → Failed? + ↓ +Attempt 2 → Failed? + ↓ +STOP. Mark as issue. Move on. +``` + +**Do NOT:** +- Try 5 different approaches +- Go down rabbit holes +- Burn context debugging +- Stop production for every error + +**DO:** +- Note the issue clearly +- Note what was tried +- Move to next task +- Let branch manager decide priority + +### Critical vs Non-Critical Issues + +When you see an issue, decide: + +| Question | If YES → | If NO → | +|----------|----------|---------| +| Does this block ALL future phases? | STOP. Investigate. | Continue. | +| Can the system work around this? | Continue. | STOP. Investigate. | +| Is this a syntax/import error? | Quick fix, continue. | - | +| Is this a logic/design problem? | Note it. Continue. | - | + +**Critical (stop production):** +- Core module won't import at all +- Database/file system inaccessible +- Fundamental architecture wrong + +**Non-critical (note and continue):** +- One command throws error but others work +- Registry not updating properly +- Edge case not handled +- Test failing but code runs + +**Pattern:** Note issue → Continue building → Fix at end with complete picture + +### False Positives Awareness + +Seedgo audits are helpful but not infallible. + +**When Seedgo flags something:** +1. Check if the code is actually correct from your understanding +2. If you're confident it's right → mark as false positive, move on +3. If you're unsure → note it, continue, review later + +**Don't stop production for:** +- Style preferences (comments, spacing) +- Patterns that differ from Seedgo's but still work +- Checks that don't apply to your context + +### Forward Momentum Summary +- **Don't stop to fix bugs during phases** - Note them, keep moving +- **Get complete picture first** - All phases done, THEN systematic fixes +- **Prevents:** Bug-fixing rabbit holes, premature optimization, scope creep +- **Review happens at END** - not every phase + +### Production Stop Protocol + +If something causes production to STOP (critical blocker), **immediately email @devpulse**: + +```bash +drone @ai_mail send @devpulse "PRODUCTION STOPPED: FPLAN-0010" "Phase X halted. Issue: [description]. Attempted: [what was tried]. Awaiting guidance." +``` + +**Never leave a branch stopped without reporting.** The orchestration hub needs visibility into all work. + +### Monitoring Resources + +For quick status checks and debugging, these resources are available: + +| Resource | Location | Purpose | +|----------|----------|---------| +| Branch logs | `logs/` directory | Local execution logs | +| JSON tree | `apps/json_templates/` | Module firing status | +| Prax monitor | `drone @prax monitor` | Real-time system events | +| Seedgo audit | `drone @seedgo audit @branch` | Code quality check | + +Use these when you need to confirm status or investigate issues. + +### Agent Deployment Per Phase +Each phase = focused agent deployment: +1. Create sub-plan: `drone @flow create . "Phase X: [name]"` +2. Write agent instructions in sub-plan +3. Deploy agent with single-task focus +4. Review agent output (don't rebuild yourself) +5. Seedgo checklist on new code +6. Close sub-plan +7. Update memories +8. Email status to @devpulse +9. Next phase + +### Agent Preparation (Before Deploying) + +Agents can't work blind. They need context before they build. + +**Your Prep Work (as orchestrator):** +1. [ ] Know where agent will work (branch path, key directories) +2. [ ] Identify files agent needs to reference or modify +3. [ ] Gather any specs, planning docs, or examples to include +4. [ ] Prepare COMPLETE instructions (agents are stateless) + +**Agent's First Task (context building):** +- Agent should explore/read relevant files BEFORE writing code +- "First, read X and Y to understand the current structure" +- "Look at Z for the pattern to follow" +- Context-first, build-second + +**What Agents DON'T Have:** +- No prior conversation history +- No memory files loaded automatically +- No knowledge of other branches +- Only what you put in their instructions + +**Your instructions determine success - be thorough and specific.** + +### Agent Instructions Template +``` +You are working at [BRANCH_PATH]. + +TASK: [Specific single task for this phase] + +CONTEXT: +- [What they need to know] +- Reference: [planning docs, existing code to study] +- First, READ the relevant files to understand current structure + +DELIVERABLES: +- [Specific file or output expected] +- Tests → tests/ +- Reports/logs → artifacts/reports/ or artifacts/logs/ + +CONSTRAINTS: +- Follow Seedgo standards (3-layer architecture: apps/modules/handlers) +- Do NOT modify files outside your task scope +- CROSS-BRANCH: Never modify other branches' files unless explicitly authorized by the user in the planning doc +- 2-ATTEMPT RULE: If something fails twice, note the issue and move on +- Do NOT go down rabbit holes debugging + +WHEN COMPLETE: +- Verify code runs without syntax errors +- List files created/modified +- Note any issues encountered (with what was attempted) +``` + +--- + +## Phase Tracking + +### Phase 1: [Name] +- [ ] Sub-plan created: FPLAN-____ +- [ ] Agent deployed +- [ ] Agent completed +- [ ] Output reviewed +- [ ] Seedgo checklist passed +- [ ] Sub-plan closed +- [ ] Memories updated +- [ ] Email sent to @devpulse +- **Status:** Pending / In Progress / Complete +- **Notes:** [Outcomes, issues, adjustments] + +### Phase 2: [Name] +- [ ] Sub-plan created: FPLAN-____ +- [ ] Agent deployed +- [ ] Agent completed +- [ ] Output reviewed +- [ ] Seedgo checklist passed +- [ ] Sub-plan closed +- [ ] Memories updated +- [ ] Email sent to @devpulse +- **Status:** Pending / In Progress / Complete +- **Notes:** [Outcomes, issues, adjustments] + +### Phase 3: [Name] +- [ ] Sub-plan created: FPLAN-____ +- [ ] Agent deployed +- [ ] Agent completed +- [ ] Output reviewed +- [ ] Seedgo checklist passed +- [ ] Sub-plan closed +- [ ] Memories updated +- [ ] Email sent to @devpulse +- **Status:** Pending / In Progress / Complete +- **Notes:** [Outcomes, issues, adjustments] + +### Phase 4: [Name] +- [ ] Sub-plan created: FPLAN-____ +- [ ] Agent deployed +- [ ] Agent completed +- [ ] Output reviewed +- [ ] Seedgo checklist passed +- [ ] Sub-plan closed +- [ ] Memories updated +- [ ] Email sent to @devpulse +- **Status:** Pending / In Progress / Complete +- **Notes:** [Outcomes, issues, adjustments] + +[Copy template for additional phases] + +--- + +## Issues Log + +Track issues here as you encounter them. Don't fix during build - log and continue. + +| Phase | Issue | Severity | Attempted | Status | +|-------|-------|----------|-----------|--------| +| 1 | [description] | Low/Med/High | [what was tried] | Open/Resolved | +| 2 | [description] | Low/Med/High | [what was tried] | Open/Resolved | + +**Severity Guide:** +- **High:** Blocks future phases, must fix before continuing +- **Med:** Affects functionality but can work around +- **Low:** Cosmetic, edge case, or false positive + +**End of Build:** Review this log. Tackle High→Med→Low. Some Low issues may not need fixing. + +--- + +## Master Plan Notes + +**Cross-Phase Patterns:** +[Patterns discovered that span multiple phases] + +**Blockers & Resolutions:** +[Significant blockers and how resolved] + +**Adjustments:** +[Changes to planned phases - scope changes, phases added/merged] + +--- + +## Final Completion Checklist + +### Before Closing Master Plan + +- [ ] All phases complete +- [ ] All sub-plans closed +- [ ] Issues Log reviewed - High/Med issues addressed +- [ ] Full branch audit: `drone @seedgo audit @branch` +- [ ] Branch memories updated: + - [ ] `BRANCH.local.json` - full session log + - [ ] `BRANCH.observations.json` - patterns learned +- [ ] README.md updated (status, architecture, API - if build changed capabilities) +- [ ] Artifacts reviewed (devpulse manages cleanup) +- [ ] Final email to @devpulse: + ```bash + drone @ai_mail send @devpulse "FPLAN-0010 MASTER COMPLETE" "Full build summary: phases completed, deliverables, remaining issues (if any)" + ``` + +**Completion Order:** Memories → README → Email (README before email - don't report complete with stale docs) + +**Note:** Devpulse will perform its own Seedgo audit for visibility into the work. + +### Definition of Done +[What specifically defines the project complete?] + +--- + +## Close Command + +When ALL phases complete and checklist done: +```bash +drone @flow close FPLAN-0010 +``` diff --git a/src/aipass/memory/.aipass/branch_system_prompt.md b/src/aipass/memory/.aipass/branch_system_prompt.md deleted file mode 100644 index b8ad85f5..00000000 --- a/src/aipass/memory/.aipass/branch_system_prompt.md +++ /dev/null @@ -1,14 +0,0 @@ -# MEMORY Branch-Local Context - - -> Auto-created by aipass init. Customize for your branch. - -## Status: NEEDS CONFIGURATION - -This file is injected into every AI conversation when working from this branch directory. Configure it with: - -- Who this branch is (role, purpose) -- Key commands and workflows -- Architecture overview -- Critical files and operational rules -- Integration points with other branches diff --git a/src/aipass/memory/apps/handlers/archive/indexer.py b/src/aipass/memory/apps/handlers/archive/indexer.py index 373349cf..7680f9e0 100644 --- a/src/aipass/memory/apps/handlers/archive/indexer.py +++ b/src/aipass/memory/apps/handlers/archive/indexer.py @@ -36,7 +36,7 @@ from typing import Dict, Any, List logger = logging.getLogger(__name__) # Paths resolved relative to handler location -_MEMORY_ROOT = Path(__file__).resolve().parents[4] +_MEMORY_ROOT = Path(__file__).resolve().parents[3] CODE_ARCHIVE_PATH = _MEMORY_ROOT / "code_archive" INDEX_PATH = CODE_ARCHIVE_PATH / "index.json" diff --git a/src/aipass/memory/apps/handlers/json/json_handler.py b/src/aipass/memory/apps/handlers/json/json_handler.py index 01123301..fb97e216 100644 --- a/src/aipass/memory/apps/handlers/json/json_handler.py +++ b/src/aipass/memory/apps/handlers/json/json_handler.py @@ -45,7 +45,7 @@ from datetime import datetime logger = logging.getLogger(__name__) # Resolve paths relative to handler location -_MEMORY_ROOT = Path(__file__).resolve().parents[4] +_MEMORY_ROOT = Path(__file__).resolve().parents[3] _CONFIG_DIR = _MEMORY_ROOT / "config" _TEMPLATES_DIR = _MEMORY_ROOT / "apps" / "json_templates" diff --git a/src/aipass/memory/apps/handlers/learnings/manager.py b/src/aipass/memory/apps/handlers/learnings/manager.py index cdc9cc49..001c065b 100644 --- a/src/aipass/memory/apps/handlers/learnings/manager.py +++ b/src/aipass/memory/apps/handlers/learnings/manager.py @@ -52,7 +52,7 @@ from aipass.memory.apps.handlers.json.json_handler import ( ) # ChromaDB subprocess for vectorization (resolved relative to handler location) -_MEMORY_ROOT = Path(__file__).resolve().parents[4] +_MEMORY_ROOT = Path(__file__).resolve().parents[3] CHROMA_SUBPROCESS_SCRIPT = _MEMORY_ROOT / "apps" / "handlers" / "storage" / "chroma_subprocess.py" # Defaults diff --git a/src/aipass/memory/apps/handlers/monitor/detector.py b/src/aipass/memory/apps/handlers/monitor/detector.py index 6d67a4db..25bc8979 100644 --- a/src/aipass/memory/apps/handlers/monitor/detector.py +++ b/src/aipass/memory/apps/handlers/monitor/detector.py @@ -117,7 +117,7 @@ def _load_config() -> Dict[str, Any]: Config dict, or empty dict on error """ # Look for config relative to this handler's location - config_path = Path(__file__).resolve().parents[4] / "config" / "memory_bank.config.json" + config_path = Path(__file__).resolve().parents[3] / "config" / "memory_bank.config.json" if not config_path.exists(): return {} diff --git a/src/aipass/memory/apps/handlers/monitor/memory_watcher.py b/src/aipass/memory/apps/handlers/monitor/memory_watcher.py index 23084929..ddc1b152 100644 --- a/src/aipass/memory/apps/handlers/monitor/memory_watcher.py +++ b/src/aipass/memory/apps/handlers/monitor/memory_watcher.py @@ -54,7 +54,7 @@ from aipass.memory.apps.handlers.monitor.detector import check_single_file logger = logging.getLogger(__name__) # Memory root resolved relative to handler location -_MEMORY_ROOT = Path(__file__).resolve().parents[4] +_MEMORY_ROOT = Path(__file__).resolve().parents[3] # Global observer instance _observer: Optional[Observer] = None diff --git a/src/aipass/memory/apps/handlers/search/vector_search.py b/src/aipass/memory/apps/handlers/search/vector_search.py index 7cf38670..6d16581f 100644 --- a/src/aipass/memory/apps/handlers/search/vector_search.py +++ b/src/aipass/memory/apps/handlers/search/vector_search.py @@ -47,7 +47,7 @@ from pathlib import Path logger = logging.getLogger(__name__) # Resolve paths relative to handler location -_MEMORY_ROOT = Path(__file__).resolve().parents[4] +_MEMORY_ROOT = Path(__file__).resolve().parents[3] # Shared ChromaDB client (reuse from chroma handler) from aipass.memory.apps.handlers.storage.chroma import get_client diff --git a/src/aipass/memory/apps/handlers/storage/chroma.py b/src/aipass/memory/apps/handlers/storage/chroma.py index 314dc453..fb879a1b 100644 --- a/src/aipass/memory/apps/handlers/storage/chroma.py +++ b/src/aipass/memory/apps/handlers/storage/chroma.py @@ -47,7 +47,7 @@ from datetime import datetime logger = logging.getLogger(__name__) # Resolve paths relative to handler location -_MEMORY_ROOT = Path(__file__).resolve().parents[4] +_MEMORY_ROOT = Path(__file__).resolve().parents[3] # ChromaDB client - create inline since the old symbolic.chroma_client # was an internal singleton wrapper diff --git a/src/aipass/seedgo/apps/standards/aipass/handlers/standards/architecture_check.py b/src/aipass/seedgo/apps/standards/aipass/handlers/standards/architecture_check.py index 6b582f5d..54c200b9 100644 --- a/src/aipass/seedgo/apps/standards/aipass/handlers/standards/architecture_check.py +++ b/src/aipass/seedgo/apps/standards/aipass/handlers/standards/architecture_check.py @@ -6,7 +6,7 @@ Checks 3-layer pattern, handler independence, file size, domain organization. For entry points, also verifies entire branch structure against template baseline. """ -# =================== META ==================== +# =================== AIPass ==================== # Name: architecture_check.py # Description: Architecture Standards Checker Handler # Version: 1.0.0 diff --git a/src/aipass/seedgo/apps/standards/aipass/handlers/standards/architecture_content.py b/src/aipass/seedgo/apps/standards/aipass/handlers/standards/architecture_content.py index ac82508b..f6e51ef5 100644 --- a/src/aipass/seedgo/apps/standards/aipass/handlers/standards/architecture_content.py +++ b/src/aipass/seedgo/apps/standards/aipass/handlers/standards/architecture_content.py @@ -5,7 +5,7 @@ Provides formatted Architecture standards content. Module orchestrates, handler implements. """ -# =================== META ==================== +# =================== AIPass ==================== # Name: architecture_content.py # Description: Architecture Standards Content Handler # Version: 1.0.0 diff --git a/src/aipass/seedgo/apps/standards/aipass/handlers/standards/cli_check.py b/src/aipass/seedgo/apps/standards/aipass/handlers/standards/cli_check.py index 6efa0b66..26e8d91a 100644 --- a/src/aipass/seedgo/apps/standards/aipass/handlers/standards/cli_check.py +++ b/src/aipass/seedgo/apps/standards/aipass/handlers/standards/cli_check.py @@ -5,7 +5,7 @@ Validates module compliance with AIPass CLI standards. Checks console.print() usage, CLI service imports, handler separation. """ -# =================== META ==================== +# =================== AIPass ==================== # Name: cli_check.py # Description: CLI Standards Checker Handler # Version: 1.0.0 @@ -233,9 +233,10 @@ def check_handler_separation(content: str) -> Dict: console_print_lines.append(i) # Look for actual CLI service imports - if 'from cli.apps.modules import' in stripped: + if 'from aipass.cli.apps.modules import' in stripped or 'from aipass.cli import' in stripped: # Skip if in a string - if '"from cli.apps.modules import' in line or "'from cli.apps.modules import" in line: + if ('"from aipass.cli.apps.modules import' in line or "'from aipass.cli.apps.modules import" in line + or '"from aipass.cli import' in line or "'from aipass.cli import" in line): continue # This is likely an actual import cli_import_lines.append(i) @@ -288,12 +289,12 @@ def check_cli_imports(content: str, module_path: str = "") -> Optional[Dict]: 'message': 'CLI branch exempt (uses internal imports)' } - # Check for CLI imports - has_cli_imports = 'from cli.apps.modules import' in content + # Check for CLI imports (canonical or shortcut via cli/__init__.py) + has_cli_imports = 'from aipass.cli.apps.modules import' in content or 'from aipass.cli import' in content if has_cli_imports: - # Check what's imported - import_match = re.search(r'from cli\.apps\.modules import (.+)', content) + # Check what's imported (canonical full path or shortcut via __init__.py) + import_match = re.search(r'from aipass\.cli\.apps\.modules import (.+)', content) or re.search(r'from aipass\.cli import (.+)', content) if import_match: imports = import_match.group(1) return { diff --git a/src/aipass/seedgo/apps/standards/aipass/handlers/standards/cli_content.py b/src/aipass/seedgo/apps/standards/aipass/handlers/standards/cli_content.py index e4dca38d..6f192f9c 100644 --- a/src/aipass/seedgo/apps/standards/aipass/handlers/standards/cli_content.py +++ b/src/aipass/seedgo/apps/standards/aipass/handlers/standards/cli_content.py @@ -5,7 +5,7 @@ Provides formatted CLI standards content. Module orchestrates, handler implements. """ -# =================== META ==================== +# =================== AIPass ==================== # Name: cli_content.py # Description: CLI Standards Content Handler # Version: 1.0.0 diff --git a/src/aipass/seedgo/apps/standards/aipass/handlers/standards/cli_flags_check.py b/src/aipass/seedgo/apps/standards/aipass/handlers/standards/cli_flags_check.py index ba1f68d9..6780988e 100644 --- a/src/aipass/seedgo/apps/standards/aipass/handlers/standards/cli_flags_check.py +++ b/src/aipass/seedgo/apps/standards/aipass/handlers/standards/cli_flags_check.py @@ -13,7 +13,7 @@ apps/handlers/ or apps/modules/). Non-entry-point files are skipped with a pass. """ -# =================== META ==================== +# =================== AIPass ==================== # Name: cli_flags_check.py # Description: CLI Flags Standards Checker Handler # Version: 1.0.0 diff --git a/src/aipass/seedgo/apps/standards/aipass/handlers/standards/cli_flags_content.py b/src/aipass/seedgo/apps/standards/aipass/handlers/standards/cli_flags_content.py index dbc72d0c..57ca55a5 100644 --- a/src/aipass/seedgo/apps/standards/aipass/handlers/standards/cli_flags_content.py +++ b/src/aipass/seedgo/apps/standards/aipass/handlers/standards/cli_flags_content.py @@ -4,7 +4,7 @@ CLI Flags Standards Content Provides Rich-formatted reference text for the CLI flags standard. """ -# =================== META ==================== +# =================== AIPass ==================== # Name: cli_flags_content.py # Description: CLI Flags Standards Content # Version: 1.0.0 diff --git a/src/aipass/seedgo/apps/standards/aipass/handlers/standards/diagnostics_check.py b/src/aipass/seedgo/apps/standards/aipass/handlers/standards/diagnostics_check.py index d31b7cc8..3ca4476f 100644 --- a/src/aipass/seedgo/apps/standards/aipass/handlers/standards/diagnostics_check.py +++ b/src/aipass/seedgo/apps/standards/aipass/handlers/standards/diagnostics_check.py @@ -5,7 +5,7 @@ Uses pyright to detect type errors, undefined variables, and other static analysis issues that would show as Pylance errors in VS Code. """ -# =================== META ==================== +# =================== AIPass ==================== # Name: diagnostics_check.py # Description: Type Error Diagnostics Checker # Version: 1.0.0 diff --git a/src/aipass/seedgo/apps/standards/aipass/handlers/standards/documentation_check.py b/src/aipass/seedgo/apps/standards/aipass/handlers/standards/documentation_check.py index 518d015a..c276b2c3 100644 --- a/src/aipass/seedgo/apps/standards/aipass/handlers/standards/documentation_check.py +++ b/src/aipass/seedgo/apps/standards/aipass/handlers/standards/documentation_check.py @@ -5,7 +5,7 @@ Validates documentation compliance: module docstrings and function docstrings. META block validation is handled separately by meta_check.py. """ -# =================== META ==================== +# =================== AIPass ==================== # Name: documentation_check.py # Description: Documentation Standards Checker Handler # Version: 1.0.0 diff --git a/src/aipass/seedgo/apps/standards/aipass/handlers/standards/documentation_content.py b/src/aipass/seedgo/apps/standards/aipass/handlers/standards/documentation_content.py index 80cabd69..5fc0b954 100644 --- a/src/aipass/seedgo/apps/standards/aipass/handlers/standards/documentation_content.py +++ b/src/aipass/seedgo/apps/standards/aipass/handlers/standards/documentation_content.py @@ -5,7 +5,7 @@ Condensed documentation standards verified against actual codebase. Truth-checked 2025-11-13 against spawn and seedgo production code. """ -# =================== META ==================== +# =================== AIPass ==================== # Name: documentation_content.py # Description: Documentation Standards Content Handler # Version: 1.0.0 @@ -28,9 +28,9 @@ def get_documentation_standards() -> str: "", "─" * 70, "", - "[bold cyan]REQUIRED: META HEADER (Every Python file)[/bold cyan]", + "[bold cyan]REQUIRED: AIPass HEADER (Every Python file)[/bold cyan]", "", - " [dim]# =================== META ====================[/dim]", + " [dim]# =================== AIPass ====================[/dim]", " [dim]# Name: filename.py[/dim]", " [dim]# Description: Brief description of the file[/dim]", " [dim]# Version: 1.0.0[/dim]", @@ -39,7 +39,7 @@ def get_documentation_standards() -> str: " [dim]# =============================================[/dim]", "", "[yellow]KEY RULES:[/yellow]", - " 1. META block = AI-scannable metadata", + " 1. AIPass block = AI-scannable metadata", " 2. Name must match the actual filename", " 3. Version uses semantic versioning (X.Y.Z)", " 4. Created/Modified use ISO date format (YYYY-MM-DD)", @@ -58,7 +58,7 @@ def get_documentation_standards() -> str: " \"\"\"[/dim]", "", "[yellow]RULES:[/yellow]", - " • Goes right after META block", + " • Goes right after AIPass block", " • Tells WHAT the file does (not HOW)", " • Keep brief - details go in function docstrings", "", diff --git a/src/aipass/seedgo/apps/standards/aipass/handlers/standards/encapsulation_check.py b/src/aipass/seedgo/apps/standards/aipass/handlers/standards/encapsulation_check.py index 4baef4b2..d7378393 100644 --- a/src/aipass/seedgo/apps/standards/aipass/handlers/standards/encapsulation_check.py +++ b/src/aipass/seedgo/apps/standards/aipass/handlers/standards/encapsulation_check.py @@ -7,7 +7,7 @@ Validates that handlers are properly encapsulated: - Handlers should be accessed through module entry points, not directly """ -# =================== META ==================== +# =================== AIPass ==================== # Name: encapsulation_check.py # Description: Handler Encapsulation Standards Checker # Version: 1.0.0 @@ -426,9 +426,14 @@ def check_cross_package_imports(lines: List[str], module_path: str, continue # Allow default handlers + is_allowed = False for allowed in allowed_handlers: if allowed in code_part: - continue + is_allowed = True + break + + if is_allowed: + continue # This is a cross-package handler import violations.append({ diff --git a/src/aipass/seedgo/apps/standards/aipass/handlers/standards/error_handling_check.py b/src/aipass/seedgo/apps/standards/aipass/handlers/standards/error_handling_check.py index 8d2277cd..3cee9565 100644 --- a/src/aipass/seedgo/apps/standards/aipass/handlers/standards/error_handling_check.py +++ b/src/aipass/seedgo/apps/standards/aipass/handlers/standards/error_handling_check.py @@ -5,7 +5,7 @@ Validates module compliance with AIPass 3-tier logging standards. Checks Prax imports in modules/handlers, logger calls in handlers. """ -# =================== META ==================== +# =================== AIPass ==================== # Name: error_handling_check.py # Description: Error Handling Standards Checker Handler # Version: 1.0.0 @@ -163,6 +163,7 @@ def check_module_has_prax(content: str, file_path: str, bypass_rules: list | Non has_prax_import = ( 'from aipass.prax import logger' in content or 'from aipass.prax import' in content and 'logger' in content + or 'from aipass.prax.apps.modules.logger import system_logger' in content ) if has_prax_import: @@ -238,7 +239,7 @@ def check_module_error_logging(content: str) -> Dict: """ has_prax_import = 'from aipass.prax import logger' in content or ( 'from aipass.prax import' in content and 'logger' in content - ) + ) or 'from aipass.prax.apps.modules.logger import system_logger' in content if has_prax_import: return { diff --git a/src/aipass/seedgo/apps/standards/aipass/handlers/standards/error_handling_content.py b/src/aipass/seedgo/apps/standards/aipass/handlers/standards/error_handling_content.py index 63d4b342..1db68e71 100644 --- a/src/aipass/seedgo/apps/standards/aipass/handlers/standards/error_handling_content.py +++ b/src/aipass/seedgo/apps/standards/aipass/handlers/standards/error_handling_content.py @@ -5,7 +5,7 @@ Provides formatted error handling standards content (3-tier architecture). Module orchestrates, handler implements. """ -# =================== META ==================== +# =================== AIPass ==================== # Name: error_handling_content.py # Description: Error Handling Standards Content Handler # Version: 1.0.0 diff --git a/src/aipass/seedgo/apps/standards/aipass/handlers/standards/handlers_check.py b/src/aipass/seedgo/apps/standards/aipass/handlers/standards/handlers_check.py index 3de4bca2..346048d6 100644 --- a/src/aipass/seedgo/apps/standards/aipass/handlers/standards/handlers_check.py +++ b/src/aipass/seedgo/apps/standards/aipass/handlers/standards/handlers_check.py @@ -5,7 +5,7 @@ Validates handler compliance with AIPass handler standards. Checks handler independence, auto-detection pattern, no orchestration. """ -# =================== META ==================== +# =================== AIPass ==================== # Name: handlers_check.py # Description: Handlers Standards Checker Handler # Version: 1.0.0 diff --git a/src/aipass/seedgo/apps/standards/aipass/handlers/standards/handlers_content.py b/src/aipass/seedgo/apps/standards/aipass/handlers/standards/handlers_content.py index 831ab2f1..1597dc3b 100644 --- a/src/aipass/seedgo/apps/standards/aipass/handlers/standards/handlers_content.py +++ b/src/aipass/seedgo/apps/standards/aipass/handlers/standards/handlers_content.py @@ -8,7 +8,7 @@ Provides formatted handlers standards content. Module orchestrates, handler implements. """ -# =================== META ==================== +# =================== AIPass ==================== # Name: handlers_content.py # Description: Handlers Content # Version: 1.0.0 diff --git a/src/aipass/seedgo/apps/standards/aipass/handlers/standards/imports_check.py b/src/aipass/seedgo/apps/standards/aipass/handlers/standards/imports_check.py index e2bb0947..6c019703 100644 --- a/src/aipass/seedgo/apps/standards/aipass/handlers/standards/imports_check.py +++ b/src/aipass/seedgo/apps/standards/aipass/handlers/standards/imports_check.py @@ -6,7 +6,7 @@ Checks for clean pip-style imports: no AIPASS_ROOT, no sys.path hacking, proper aipass.* namespace usage, correct import order. """ -# =================== META ==================== +# =================== AIPass ==================== # Name: imports_check.py # Description: Imports Standards Checker Handler # Version: 2.0.0 diff --git a/src/aipass/seedgo/apps/standards/aipass/handlers/standards/imports_content.py b/src/aipass/seedgo/apps/standards/aipass/handlers/standards/imports_content.py index acdbda62..a29d1049 100644 --- a/src/aipass/seedgo/apps/standards/aipass/handlers/standards/imports_content.py +++ b/src/aipass/seedgo/apps/standards/aipass/handlers/standards/imports_content.py @@ -5,7 +5,7 @@ Provides formatted import standards content. Module orchestrates, handler implements. """ -# =================== META ==================== +# =================== AIPass ==================== # Name: imports_content.py # Description: Import Standards Content Handler # Version: 1.0.0 diff --git a/src/aipass/seedgo/apps/standards/aipass/handlers/standards/json_structure_check.py b/src/aipass/seedgo/apps/standards/aipass/handlers/standards/json_structure_check.py index 33fbed1a..f081861c 100644 --- a/src/aipass/seedgo/apps/standards/aipass/handlers/standards/json_structure_check.py +++ b/src/aipass/seedgo/apps/standards/aipass/handlers/standards/json_structure_check.py @@ -7,7 +7,7 @@ Validates JSON handling patterns for pip packages: - Branch detection via AIPASS_REGISTRY.json and BRANCH_REGISTRY.json """ -# =================== META ==================== +# =================== AIPass ==================== # Name: json_structure_check.py # Description: JSON Structure Standards Checker Handler # Version: 2.0.0 diff --git a/src/aipass/seedgo/apps/standards/aipass/handlers/standards/json_structure_content.py b/src/aipass/seedgo/apps/standards/aipass/handlers/standards/json_structure_content.py index f1e9ca73..357dff52 100644 --- a/src/aipass/seedgo/apps/standards/aipass/handlers/standards/json_structure_content.py +++ b/src/aipass/seedgo/apps/standards/aipass/handlers/standards/json_structure_content.py @@ -5,7 +5,7 @@ Provides formatted JSON structure standards content. Module orchestrates, handler implements. """ -# =================== META ==================== +# =================== AIPass ==================== # Name: json_structure_content.py # Description: JSON Structure Standards Content Handler # Version: 1.0.0 diff --git a/src/aipass/seedgo/apps/standards/aipass/handlers/standards/log_handler_check.py b/src/aipass/seedgo/apps/standards/aipass/handlers/standards/log_handler_check.py index 08c21e91..14916ce2 100644 --- a/src/aipass/seedgo/apps/standards/aipass/handlers/standards/log_handler_check.py +++ b/src/aipass/seedgo/apps/standards/aipass/handlers/standards/log_handler_check.py @@ -12,7 +12,7 @@ THE STANDARD: - Prax's own logging infrastructure is exempt (it IS the implementation) """ -# =================== META ==================== +# =================== AIPass ==================== # Name: log_handler_check.py # Description: Log Handler Standards Checker Handler # Version: 1.0.0 diff --git a/src/aipass/seedgo/apps/standards/aipass/handlers/standards/log_handler_content.py b/src/aipass/seedgo/apps/standards/aipass/handlers/standards/log_handler_content.py index af0fdc46..1c40b684 100644 --- a/src/aipass/seedgo/apps/standards/aipass/handlers/standards/log_handler_content.py +++ b/src/aipass/seedgo/apps/standards/aipass/handlers/standards/log_handler_content.py @@ -4,7 +4,7 @@ Log Handler Standards Content Provides Rich-formatted reference text for the log handler rotation standard. """ -# =================== META ==================== +# =================== AIPass ==================== # Name: log_handler_content.py # Description: Log Handler Standards Content # Version: 1.0.0 diff --git a/src/aipass/seedgo/apps/standards/aipass/handlers/standards/log_level_check.py b/src/aipass/seedgo/apps/standards/aipass/handlers/standards/log_level_check.py index bdf8b2be..1e2557eb 100644 --- a/src/aipass/seedgo/apps/standards/aipass/handlers/standards/log_level_check.py +++ b/src/aipass/seedgo/apps/standards/aipass/handlers/standards/log_level_check.py @@ -12,7 +12,7 @@ THE STANDARD: - INFO = Normal operations, successful completions, discoveries """ -# =================== META ==================== +# =================== AIPass ==================== # Name: log_level_check.py # Description: Log Level Hygiene Standards Checker Handler # Version: 1.0.0 diff --git a/src/aipass/seedgo/apps/standards/aipass/handlers/standards/log_level_content.py b/src/aipass/seedgo/apps/standards/aipass/handlers/standards/log_level_content.py index 357871d6..7e98bfef 100644 --- a/src/aipass/seedgo/apps/standards/aipass/handlers/standards/log_level_content.py +++ b/src/aipass/seedgo/apps/standards/aipass/handlers/standards/log_level_content.py @@ -4,7 +4,7 @@ Log Level Hygiene Standards Content Provides Rich-formatted reference text for the log level hygiene standard. """ -# =================== META ==================== +# =================== AIPass ==================== # Name: log_level_content.py # Description: Log Level Hygiene Standards Content # Version: 1.0.0 diff --git a/src/aipass/seedgo/apps/standards/aipass/handlers/standards/log_structure_check.py b/src/aipass/seedgo/apps/standards/aipass/handlers/standards/log_structure_check.py index cef869db..ce42c2a7 100644 --- a/src/aipass/seedgo/apps/standards/aipass/handlers/standards/log_structure_check.py +++ b/src/aipass/seedgo/apps/standards/aipass/handlers/standards/log_structure_check.py @@ -6,7 +6,7 @@ every module should have a logs/ directory for module-local logs. No hardcoded absolute log paths. """ -# =================== META ==================== +# =================== AIPass ==================== # Name: log_structure_check.py # Description: Log Structure Standards Checker Handler # Version: 1.0.0 diff --git a/src/aipass/seedgo/apps/standards/aipass/handlers/standards/log_structure_content.py b/src/aipass/seedgo/apps/standards/aipass/handlers/standards/log_structure_content.py index 88a4c508..a0d9185c 100644 --- a/src/aipass/seedgo/apps/standards/aipass/handlers/standards/log_structure_content.py +++ b/src/aipass/seedgo/apps/standards/aipass/handlers/standards/log_structure_content.py @@ -4,7 +4,7 @@ Log Structure Standards Content Handler Provides formatted display of log structure standards for terminal output. """ -# =================== META ==================== +# =================== AIPass ==================== # Name: log_structure_content.py # Description: Log Structure Standards Content Handler # Version: 1.0.0 diff --git a/src/aipass/seedgo/apps/standards/aipass/handlers/standards/log_visibility_check.py b/src/aipass/seedgo/apps/standards/aipass/handlers/standards/log_visibility_check.py index 2457b888..753bb7ba 100644 --- a/src/aipass/seedgo/apps/standards/aipass/handlers/standards/log_visibility_check.py +++ b/src/aipass/seedgo/apps/standards/aipass/handlers/standards/log_visibility_check.py @@ -12,7 +12,7 @@ TWO CHECKS: Prax logging infrastructure and test files are exempt from both checks. """ -# =================== META ==================== +# =================== AIPass ==================== # Name: log_visibility_check.py # Description: Log Visibility Standards Checker Handler # Version: 1.0.0 diff --git a/src/aipass/seedgo/apps/standards/aipass/handlers/standards/log_visibility_content.py b/src/aipass/seedgo/apps/standards/aipass/handlers/standards/log_visibility_content.py index 8e6e5e80..57c0180d 100644 --- a/src/aipass/seedgo/apps/standards/aipass/handlers/standards/log_visibility_content.py +++ b/src/aipass/seedgo/apps/standards/aipass/handlers/standards/log_visibility_content.py @@ -4,7 +4,7 @@ Log Visibility Standards Content Provides Rich-formatted reference text for the log visibility standard. """ -# =================== META ==================== +# =================== AIPass ==================== # Name: log_visibility_content.py # Description: Log Visibility Standards Content # Version: 1.0.0 diff --git a/src/aipass/seedgo/apps/standards/aipass/handlers/standards/meta_check.py b/src/aipass/seedgo/apps/standards/aipass/handlers/standards/meta_check.py index 2f8e801d..2aa15ef7 100644 --- a/src/aipass/seedgo/apps/standards/aipass/handlers/standards/meta_check.py +++ b/src/aipass/seedgo/apps/standards/aipass/handlers/standards/meta_check.py @@ -6,7 +6,7 @@ Library META is lighter than full META - focuses on identity and traceability without branch-specific fields. Required META format: - # =================== META ==================== + # =================== AIPass ==================== # Name: filename.py # Description: Brief description of the file # Version: X.Y.Z @@ -15,7 +15,7 @@ Required META format: # ============================================= """ -# =================== META ==================== +# =================== AIPass ==================== # Name: meta_check.py # Description: META Block Standards Checker Handler # Version: 1.0.0 @@ -29,7 +29,9 @@ from typing import Dict, List # Header/footer markers for library META -META_HEADER = "# =================== META ====================" +# Accept both AIPass (canonical) and META (legacy) header markers +META_HEADER = "# =================== AIPass ====================" +META_HEADER_LEGACY = "# =================== META ====================" META_FOOTER = "# =============================================" # Required fields with validation patterns @@ -132,7 +134,7 @@ def check_module(module_path: str, bypass_rules: list | None = None) -> Dict: def check_meta_presence(content: str) -> Dict: """Check that META block header and footer markers exist""" - has_header = META_HEADER in content + has_header = META_HEADER in content or META_HEADER_LEGACY in content has_footer = META_FOOTER in content if has_header and has_footer: diff --git a/src/aipass/seedgo/apps/standards/aipass/handlers/standards/modules_check.py b/src/aipass/seedgo/apps/standards/aipass/handlers/standards/modules_check.py index bda46979..483234d3 100644 --- a/src/aipass/seedgo/apps/standards/aipass/handlers/standards/modules_check.py +++ b/src/aipass/seedgo/apps/standards/aipass/handlers/standards/modules_check.py @@ -5,7 +5,7 @@ Validates module compliance with AIPass module standards. Checks handle_command pattern, thin orchestration, file size guidelines. """ -# =================== META ==================== +# =================== AIPass ==================== # Name: modules_check.py # Description: Modules Standards Checker Handler # Version: 1.0.0 diff --git a/src/aipass/seedgo/apps/standards/aipass/handlers/standards/modules_content.py b/src/aipass/seedgo/apps/standards/aipass/handlers/standards/modules_content.py index 803fcf6e..2202a4d2 100644 --- a/src/aipass/seedgo/apps/standards/aipass/handlers/standards/modules_content.py +++ b/src/aipass/seedgo/apps/standards/aipass/handlers/standards/modules_content.py @@ -5,7 +5,7 @@ Provides formatted module standards content. Module orchestrates, handler implements. """ -# =================== META ==================== +# =================== AIPass ==================== # Name: modules_content.py # Description: Modules Standards Content Handler # Version: 1.0.0 diff --git a/src/aipass/seedgo/apps/standards/aipass/handlers/standards/naming_check.py b/src/aipass/seedgo/apps/standards/aipass/handlers/standards/naming_check.py index 45623b0d..7a705f9e 100644 --- a/src/aipass/seedgo/apps/standards/aipass/handlers/standards/naming_check.py +++ b/src/aipass/seedgo/apps/standards/aipass/handlers/standards/naming_check.py @@ -5,7 +5,7 @@ Validates module compliance with AIPass naming standards. Checks file naming, function naming, variable naming, constant naming. """ -# =================== META ==================== +# =================== AIPass ==================== # Name: naming_check.py # Description: Naming Standards Checker Handler # Version: 1.0.0 diff --git a/src/aipass/seedgo/apps/standards/aipass/handlers/standards/naming_content.py b/src/aipass/seedgo/apps/standards/aipass/handlers/standards/naming_content.py index 9f518283..edb5dad4 100644 --- a/src/aipass/seedgo/apps/standards/aipass/handlers/standards/naming_content.py +++ b/src/aipass/seedgo/apps/standards/aipass/handlers/standards/naming_content.py @@ -5,7 +5,7 @@ Provides formatted naming standards content. Module orchestrates, handler implements. """ -# =================== META ==================== +# =================== AIPass ==================== # Name: naming_content.py # Description: Naming Standards Content Handler # Version: 1.0.0 diff --git a/src/aipass/seedgo/apps/standards/aipass/handlers/standards/permission_flags_check.py b/src/aipass/seedgo/apps/standards/aipass/handlers/standards/permission_flags_check.py index e3981517..d0c79e3e 100644 --- a/src/aipass/seedgo/apps/standards/aipass/handlers/standards/permission_flags_check.py +++ b/src/aipass/seedgo/apps/standards/aipass/handlers/standards/permission_flags_check.py @@ -13,7 +13,7 @@ THE STANDARD: - Documentation files that mention these flags for reference are exempt """ -# =================== META ==================== +# =================== AIPass ==================== # Name: permission_flags_check.py # Description: Permission Flags Standards Checker Handler # Version: 1.0.0 diff --git a/src/aipass/seedgo/apps/standards/aipass/handlers/standards/permission_flags_content.py b/src/aipass/seedgo/apps/standards/aipass/handlers/standards/permission_flags_content.py index 7cc16eca..4d336497 100644 --- a/src/aipass/seedgo/apps/standards/aipass/handlers/standards/permission_flags_content.py +++ b/src/aipass/seedgo/apps/standards/aipass/handlers/standards/permission_flags_content.py @@ -4,7 +4,7 @@ Permission Flags Standards Content Provides Rich-formatted reference text for the permission flags standard. """ -# =================== META ==================== +# =================== AIPass ==================== # Name: permission_flags_content.py # Description: Permission Flags Standards Content # Version: 1.0.0 diff --git a/src/aipass/seedgo/apps/standards/aipass/handlers/standards/readme_check.py b/src/aipass/seedgo/apps/standards/aipass/handlers/standards/readme_check.py index f2caa847..b6219cfb 100644 --- a/src/aipass/seedgo/apps/standards/aipass/handlers/standards/readme_check.py +++ b/src/aipass/seedgo/apps/standards/aipass/handlers/standards/readme_check.py @@ -12,7 +12,7 @@ Checks: 6. Command list presence (commands/usage section is not empty) """ -# =================== META ==================== +# =================== AIPass ==================== # Name: readme_check.py # Description: README Standards Checker Handler # Version: 1.0.0 diff --git a/src/aipass/seedgo/apps/standards/aipass/handlers/standards/readme_content.py b/src/aipass/seedgo/apps/standards/aipass/handlers/standards/readme_content.py index 3b0de00d..cedd2535 100644 --- a/src/aipass/seedgo/apps/standards/aipass/handlers/standards/readme_content.py +++ b/src/aipass/seedgo/apps/standards/aipass/handlers/standards/readme_content.py @@ -4,7 +4,7 @@ README Standards Content Provides Rich-formatted reference text for the README standard. """ -# =================== META ==================== +# =================== AIPass ==================== # Name: readme_content.py # Description: README Standards Content # Version: 1.0.0 diff --git a/src/aipass/seedgo/apps/standards/aipass/handlers/standards/readme_generator.py b/src/aipass/seedgo/apps/standards/aipass/handlers/standards/readme_generator.py index ecc1ae30..ddd99e78 100644 --- a/src/aipass/seedgo/apps/standards/aipass/handlers/standards/readme_generator.py +++ b/src/aipass/seedgo/apps/standards/aipass/handlers/standards/readme_generator.py @@ -13,7 +13,7 @@ Sections generated: - Last Updated timestamp """ -# =================== META ==================== +# =================== AIPass ==================== # Name: readme_generator.py # Description: README Section Auto-Generator # Version: 1.0.0 diff --git a/src/aipass/seedgo/apps/standards/aipass/handlers/standards/readme_ops.py b/src/aipass/seedgo/apps/standards/aipass/handlers/standards/readme_ops.py index f9dfabb9..8ec9950b 100644 --- a/src/aipass/seedgo/apps/standards/aipass/handlers/standards/readme_ops.py +++ b/src/aipass/seedgo/apps/standards/aipass/handlers/standards/readme_ops.py @@ -6,7 +6,7 @@ generator loading, and target resolution. Returns data structures for the module to display. """ -# =================== META ==================== +# =================== AIPass ==================== # Name: readme_ops.py # Description: README Update Operations Handler # Version: 1.0.0 diff --git a/src/aipass/seedgo/apps/standards/aipass/handlers/standards/shebang_check.py b/src/aipass/seedgo/apps/standards/aipass/handlers/standards/shebang_check.py index 19be73cb..dfb22690 100644 --- a/src/aipass/seedgo/apps/standards/aipass/handlers/standards/shebang_check.py +++ b/src/aipass/seedgo/apps/standards/aipass/handlers/standards/shebang_check.py @@ -7,7 +7,7 @@ pyproject.toml entry points or python3 -m. Shebangs are unnecessary and should be removed. """ -# =================== META ==================== +# =================== AIPass ==================== # Name: shebang_check.py # Description: Shebang Standards Checker Handler # Version: 1.0.0 diff --git a/src/aipass/seedgo/apps/standards/aipass/handlers/standards/template_scanner.py b/src/aipass/seedgo/apps/standards/aipass/handlers/standards/template_scanner.py index b209ac99..bc96cd8b 100644 --- a/src/aipass/seedgo/apps/standards/aipass/handlers/standards/template_scanner.py +++ b/src/aipass/seedgo/apps/standards/aipass/handlers/standards/template_scanner.py @@ -5,7 +5,7 @@ Scans Spawn template directory and generates baseline structure. Respects .registry_ignore.json patterns. """ -# =================== META ==================== +# =================== AIPass ==================== # Name: template_scanner.py # Description: Template Scanner - Automatically scan template to discover structure # Version: 1.0.0 diff --git a/src/aipass/seedgo/apps/standards/aipass/handlers/standards/testing_check.py b/src/aipass/seedgo/apps/standards/aipass/handlers/standards/testing_check.py index 27fc2ed7..4c6461cb 100644 --- a/src/aipass/seedgo/apps/standards/aipass/handlers/standards/testing_check.py +++ b/src/aipass/seedgo/apps/standards/aipass/handlers/standards/testing_check.py @@ -6,7 +6,7 @@ Checks for test functions, error handling patterns. Note: Manual testing is acceptable in current rapid iteration phase. """ -# =================== META ==================== +# =================== AIPass ==================== # Name: testing_check.py # Description: Testing Standards Checker Handler # Version: 1.0.0 diff --git a/src/aipass/seedgo/apps/standards/aipass/handlers/standards/trigger_check.py b/src/aipass/seedgo/apps/standards/aipass/handlers/standards/trigger_check.py index b8a95fb4..8bc6ffa4 100644 --- a/src/aipass/seedgo/apps/standards/aipass/handlers/standards/trigger_check.py +++ b/src/aipass/seedgo/apps/standards/aipass/handlers/standards/trigger_check.py @@ -15,7 +15,7 @@ Valid bypass categories for .seedgo/bypass.json: - utility: Helper called by event-firing function """ -# =================== META ==================== +# =================== AIPass ==================== # Name: trigger_check.py # Description: Trigger Standards Checker Handler # Version: 1.0.0 diff --git a/src/aipass/seedgo/apps/standards/aipass/handlers/standards/trigger_content.py b/src/aipass/seedgo/apps/standards/aipass/handlers/standards/trigger_content.py index 04137bba..40abdc42 100644 --- a/src/aipass/seedgo/apps/standards/aipass/handlers/standards/trigger_content.py +++ b/src/aipass/seedgo/apps/standards/aipass/handlers/standards/trigger_content.py @@ -5,7 +5,7 @@ Provides formatted Trigger event bus standards content. Module orchestrates, handler implements. """ -# =================== META ==================== +# =================== AIPass ==================== # Name: trigger_content.py # Description: Trigger Standards Content Handler # Version: 1.0.0 diff --git a/src/aipass/seedgo/docs/aipass_code_standards/architecture.md b/src/aipass/seedgo/docs/aipass_code_standards/architecture.md index 2b5857df..ceb6e2c5 100644 --- a/src/aipass/seedgo/docs/aipass_code_standards/architecture.md +++ b/src/aipass/seedgo/docs/aipass_code_standards/architecture.md @@ -36,7 +36,7 @@ apps/handlers/ (Implementation Layer) **Rule:** All branches must match the Spawn template structure. -**Source of Truth:** `/spawn/templates/agent.template/.template_registry.json` +**Source of Truth:** `src/aipass/spawn/templates/builder/.template_registry.json` **What it checks:** - All required files from template exist in branch (with proper name transformations) @@ -50,7 +50,7 @@ apps/handlers/ (Implementation Layer) - `OBSERVATIONS.json` → `{BRANCHNAME}.observations.json` - `AI_MAIL.json` → `{BRANCHNAME}.ai_mail.json` - `BRANCH.py` → `{branchname}.py` (e.g., `seedgo.py`) -- `README.md` → `README.json` (template uses .md, branches use .json) +- `README.md` → `README.md` (branches keep their README as markdown) **WHY:** Spawn creates branches from template. If branches drift from template structure (missing files/directories), updates break and branch becomes non-standard. Template is the contract - all branches must honor it. @@ -166,7 +166,7 @@ apps/handlers/ └── cli/ → Everything about user interaction ``` -**Verified from:** `/spawn/apps/handlers/` - These are actual domains from Spawn. +**Verified from:** `src/aipass/spawn/apps/handlers/` - These are actual domains from Spawn. **Note:** Actual domain names will vary by branch purpose. See naming.md for domain naming standards. @@ -311,7 +311,7 @@ Run 'python3 create_plan.py --help' for usage - Remove module → automatically gone - Zero maintenance overhead -**Implementation:** See `/seedgo/apps/seedgo.py` and `/seedgo/apps/modules/architecture_standard.py` for reference pattern. +**Implementation:** See `src/aipass/seedgo/apps/seedgo.py` and `src/aipass/seedgo/apps/modules/architecture_standard.py` for reference pattern. --- diff --git a/src/aipass/seedgo/docs/aipass_code_standards/cli_flags.md b/src/aipass/seedgo/docs/aipass_code_standards/cli_flags.md index 2fa473a9..253a34e5 100644 --- a/src/aipass/seedgo/docs/aipass_code_standards/cli_flags.md +++ b/src/aipass/seedgo/docs/aipass_code_standards/cli_flags.md @@ -307,6 +307,8 @@ Current flag support across 10 branch entry points: **Summary:** --help is 10/10. Everything else is 0-2/10. Significant opportunity for standardization. +**Note (2026-03-08):** This survey covers the original 10 branches. Five additional branches — BACKUP, DAEMON, MEMORY, COMMONS, and SKILLS — were added after this survey and are not reflected in the table above. They need the same flag standardization treatment and should be audited during Phase 1 rollout. + --- ## Notes diff --git a/src/aipass/seedgo/docs/aipass_code_standards/diagnostics.md b/src/aipass/seedgo/docs/aipass_code_standards/diagnostics.md index b9ce0d3a..53630d8f 100644 --- a/src/aipass/seedgo/docs/aipass_code_standards/diagnostics.md +++ b/src/aipass/seedgo/docs/aipass_code_standards/diagnostics.md @@ -40,12 +40,12 @@ The diagnostics checker runs pyright on Python files to detect: ### Single File ```bash -python3 src/aipass/seedgo/apps/handlers/standards/diagnostics_check.py /path/to/file.py +python3 src/aipass/seedgo/apps/standards/aipass/handlers/standards/diagnostics_check.py /path/to/file.py ``` ### Entire Directory ```bash -python3 src/aipass/seedgo/apps/handlers/standards/diagnostics_check.py src/aipass/seedgo/apps/ +python3 src/aipass/seedgo/apps/standards/aipass/handlers/standards/diagnostics_check.py src/aipass/seedgo/apps/ ``` ### Branch Check @@ -183,6 +183,6 @@ drone @seedgo audit --diagnostics ## Reference -- **Checker:** `src/aipass/seedgo/apps/handlers/standards/diagnostics_check.py` +- **Checker:** `src/aipass/seedgo/apps/standards/aipass/handlers/standards/diagnostics_check.py` - **Pyright Docs:** https://microsoft.github.io/pyright/ - **Python Typing:** https://docs.python.org/3/library/typing.html diff --git a/src/aipass/seedgo/docs/aipass_code_standards/encapsulation.md b/src/aipass/seedgo/docs/aipass_code_standards/encapsulation.md index 7b2087c1..4a24e8bc 100644 --- a/src/aipass/seedgo/docs/aipass_code_standards/encapsulation.md +++ b/src/aipass/seedgo/docs/aipass_code_standards/encapsulation.md @@ -101,7 +101,7 @@ Trigger is the ONE place where cross-branch handler imports are acceptable: ```python # In trigger/apps/handlers/events/startup.py -from aipass.memory_bank.apps.handlers.mbank.rollover import check_and_rollover +from aipass.memory.apps.handlers.rollover import check_and_rollover ``` **WHY:** Trigger's entire purpose is centralizing cross-branch reaction logic. It's the exception that proves the rule - instead of scattered cross-branch calls, Trigger owns them all in one place. @@ -154,6 +154,6 @@ For legitimate architectural exceptions, configure `.seedgo/bypass.json`: ## Reference -- **Checker:** `src/aipass/seedgo/apps/handlers/standards/encapsulation_check.py` +- **Checker:** `src/aipass/seedgo/apps/standards/aipass/handlers/standards/encapsulation_check.py` - **Handler Standard:** `src/aipass/seedgo/docs/aipass_code_standards/handlers.md` - **Architecture Standard:** `src/aipass/seedgo/docs/aipass_code_standards/architecture.md` diff --git a/src/aipass/seedgo/docs/aipass_code_standards/handlers.md b/src/aipass/seedgo/docs/aipass_code_standards/handlers.md index 297b8273..57c9a6bb 100644 --- a/src/aipass/seedgo/docs/aipass_code_standards/handlers.md +++ b/src/aipass/seedgo/docs/aipass_code_standards/handlers.md @@ -141,7 +141,7 @@ Handler → imports Module ✗ (creates cycle) **✅ ALLOWED - Same-branch handler imports (even across packages):** ```python -# seedgo/apps/handlers/standards/imports_check.py +# seedgo/apps/standards/aipass/handlers/standards/imports_check.py from aipass.seedgo.apps.handlers.json import json_handler # ✅ OK - same branch # flow/apps/handlers/plan/create.py @@ -163,7 +163,7 @@ from .logger import log_operation_start, log_operation_end **❌ FORBIDDEN - Handler imports own branch's modules:** ```python -# seedgo/apps/handlers/json/json_handler.py +# seedgo/apps/standards/aipass/handlers/json/json_handler.py from aipass.seedgo.apps.modules.create_thing import something # ❌ NO - circular risk ``` @@ -655,7 +655,7 @@ handlers/ **Current structure:** ``` -/seedgo/apps/handlers/ +/seedgo/apps/standards/aipass/handlers/ ├── json/ │ ├── json_handler.py → JSON file operations (279 lines) │ └── test_auto_detection.py → Tests diff --git a/src/aipass/seedgo/docs/aipass_code_standards/imports.md b/src/aipass/seedgo/docs/aipass_code_standards/imports.md index bd5973a1..ac6c552f 100644 --- a/src/aipass/seedgo/docs/aipass_code_standards/imports.md +++ b/src/aipass/seedgo/docs/aipass_code_standards/imports.md @@ -1,10 +1,9 @@ # Import Standards -**Status:** Draft v1 -**Date:** 2025-11-12 +**Status:** Draft v2 +**Date:** 2026-03-08 --- -#@comments:patrick:whole file needs updating -## Standard Import Order +## Standard Import Order **Every Python file follows this pattern:** @@ -37,7 +36,7 @@ from aipass.seedgo.apps.handlers.domain1 import ops 3. **Services** - CLI, other branch services (import before internal handlers) 4. **Internal imports** - After all external dependencies resolved -> **Note:** AIPass uses pip-installable namespace imports (`from aipass.{module}...`). No `sys.path` manipulation or `AIPASS_ROOT` path setup is needed. +> **Note:** AIPass uses pip-installable namespace imports (`from aipass.{module}...`). No `sys.path` manipulation needed. --- @@ -110,14 +109,17 @@ logger.warning("Memory file not found, using defaults") logger.error("Failed to backup branch", exc_info=True) ``` -**Consistency:** Same import pattern everywhere +**Both forms are valid:** ```python -# Always this +# Canonical (full path) from aipass.prax.apps.modules.logger import system_logger as logger -# Never variations like these -from aipass.prax import logger # ✗ +# Shorthand (via prax/__init__.py) +from aipass.prax import logger + +# Never these import aipass.prax.system_logger # ✗ +import logging; logging.getLogger() # ✗ Use prax, not stdlib logging ``` **Output location:** Prax manages log files, branches don't need to worry about where logs go @@ -206,7 +208,7 @@ Some AIPass services need to know **which branch is calling them** to provide pr - **Prax** - Logging service - **CLI** - Console formatting and output - **API** - LLM calls and AI interactions -- **Memory Bank** - Vector storage and search +- **Memory** - Vector storage and search **Router Services (CLI Invocation Only):** - **Drone** - NOT a library service, it's a CLI router @@ -258,7 +260,7 @@ from aipass.drone.apps.modules.router import route_command # NO! ``` **Why Drone is different:** -- **Prax/CLI/API/Memory Bank**: Library services providing functionality via imports +- **Prax/CLI/API/Memory**: Library services providing functionality via imports - **Drone**: CLI router that resolves targets and invokes other tools - Branches receive already-resolved paths/commands from Drone - Branches don't need @ handling code - Drone does that BEFORE calling them @@ -495,7 +497,7 @@ from aipass.seedgo.apps.handlers.json import json_handler | Import Type | Pattern | Required? | |-------------|---------|-----------| -| Prax logger | `from aipass.prax.apps.modules.logger import system_logger as logger` | **Nearly always** | +| Prax logger | `from aipass.prax.apps.modules.logger import system_logger as logger` or `from aipass.prax import logger` | **Nearly always** | | CLI service | `from aipass.cli.apps.modules import console, header` | When needed | | API service | `from aipass.api.apps.modules import llm_call` | When needed | | **Drone** | `subprocess.run(["drone", "cmd", ...])` | **CLI only - NEVER import** | @@ -511,13 +513,13 @@ from aipass.seedgo.apps.handlers.json import json_handler **Namespace pattern:** `from aipass.{module}...` - never bare imports or hardcoded paths -**Prax logger:** Nearly always imported - system-wide logging service +**Prax logger:** Nearly always imported - canonical or shorthand form both valid -**Service imports:** CLI, API, Memory Bank imported as libraries; Drone invoked via CLI only +**Service imports:** CLI, API, Memory imported as libraries; Drone invoked via CLI only **Drone is special:** NOT a library service - it's a CLI router. Never import from aipass.drone.apps.modules -**Handler independence:** Same-branch handler→handler ✓, Handler→own-branch-module ✗, Cross-branch handler ✗ +**Handler independence:** Same-branch handler→handler ✓, Handler→service (Prax/CLI/API/Memory) ✓, Handler→own-branch-module ✗ **Third-party libraries:** Pragmatic approach - install what you need as you build @@ -534,3 +536,4 @@ from aipass.seedgo.apps.handlers.json import json_handler #@comments:2025-11-29:claude: Added explicit "Drone: CLI Router Pattern" section with FORBIDDEN import examples #@comments:2025-11-29:claude: Clarified that branches should NEVER import from aipass.drone.apps.modules - Drone resolves @ before calling them #@comments:2026-03-07:claude: Cleaned Dev-Pass references - updated to AIPass namespace imports, removed sys.path/AIPASS_ROOT patterns, fixed /home/aipass/ paths, seed->seedgo naming +#@comments:2026-03-08:claude: Resolved patrick's "whole file needs updating" flag - fixed Memory Bank→Memory (3 occurrences), removed stale AIPASS_ROOT reference, corrected handler independence summary to reflect that handlers CAN import cross-branch services, bumped to Draft v2 diff --git a/src/aipass/seedgo/docs/aipass_code_standards/json_structure.md b/src/aipass/seedgo/docs/aipass_code_standards/json_structure.md index 8f1e33fb..c2063cc7 100644 --- a/src/aipass/seedgo/docs/aipass_code_standards/json_structure.md +++ b/src/aipass/seedgo/docs/aipass_code_standards/json_structure.md @@ -67,12 +67,12 @@ Something breaks: ```python # ❌ WRONG - Points to seedgo -SEEDGO_ROOT = Path(__file__).parents[4] # Points to seedgo branch +SEEDGO_ROOT = Path(__file__).parents[3] # Points to seedgo branch SEEDGO_JSON_DIR = SEEDGO_ROOT / "seedgo_json" JSON_TEMPLATES_DIR = SEEDGO_ROOT / "apps" / "json_templates" # ✓ CORRECT - Points to YOUR branch -API_ROOT = Path(__file__).parents[4] # Points to api branch +API_ROOT = Path(__file__).parents[3] # Points to api branch API_JSON_DIR = API_ROOT / "api_json" JSON_TEMPLATES_DIR = API_ROOT / "apps" / "json_templates" ``` @@ -90,14 +90,14 @@ AIPass uses relative path resolution, not hardcoded paths. API_ROOT = Path("/home/user/workspace/AIPass/src/aipass/api") # ✓ CORRECT - Relative path resolution -API_ROOT = Path(__file__).parents[4] # Adjust N based on handler depth +API_ROOT = Path(__file__).parents[3] # Adjust N based on handler depth ``` **Branch path patterns:** ```python # All branches live under src/aipass/{branch}/ # Use Path(__file__).parents[N] to navigate up from handler location -{BRANCH}_ROOT = Path(__file__).parents[4] # from apps/handlers/json/json_handler.py +{BRANCH}_ROOT = Path(__file__).parents[3] # from apps/handlers/json/json_handler.py ``` **2. Update JSON_DIR constant:** @@ -122,7 +122,7 @@ mkdir -p src/aipass/{branch}/apps/json_templates/default **5. Copy templates from seedgo:** ```bash -cp src/aipass/seedgo/apps/json_templates/default/*.json \ +cp src/aipass/seedgo/apps/standards/aipass/json_templates/default/*.json \ src/aipass/{branch}/apps/json_templates/default/ ``` @@ -145,7 +145,7 @@ drone @seedgo audit {branch} 1. **Using hardcoded paths instead of `Path(__file__).parents[N]`** ← Most common error! - Always use relative path resolution from the handler file - `BRANCH_ROOT = Path("/absolute/path/to/branch")` → FAILS - - `BRANCH_ROOT = Path(__file__).parents[4]` → PASSES + - `BRANCH_ROOT = Path(__file__).parents[3]` → PASSES 2. **Copying seedgo's handler without changing paths** - API and Drone both made this mistake @@ -353,27 +353,26 @@ json_handler.log_operation("operation_name", {"key": "value"}) { "metadata": { "version": "1.0.0", - "last_updated": "2025-11-13", - "total_branches": 17 + "last_updated": "2026-03-08", + "total_branches": 15 }, - "branches": [ - { - "name": "FLOW", + "branches": { + "flow": { + "name": "flow", "path": "src/aipass/flow", "email": "@flow", - "status": "active", - "created": "2025-10-30" + "status": "active" }, - { - "name": "SEEDGO", + "seedgo": { + "name": "seedgo", "path": "src/aipass/seedgo", "email": "@seedgo", - "status": "active", - "created": "2025-10-30" + "status": "active" } - ] + } } ``` +**Note:** `total_branches` is auto-computed by `setup.sh` — do not hardcode it manually. The count shown above is representative; the actual value reflects whatever branches are registered at build time. **Registry characteristics:** - **Central source of truth** for collections @@ -644,7 +643,7 @@ ls /branch/branch_json/ ### Reference Implementation -**Primary handler:** `src/aipass/seedgo/apps/handlers/json/json_handler.py` +**Primary handler:** `src/aipass/seedgo/apps/standards/aipass/handlers/json/json_handler.py` **Branch implementations:** - `src/aipass/drone/apps/handlers/json/json_handler.py` diff --git a/src/aipass/seedgo/docs/aipass_code_standards/log_handler.md b/src/aipass/seedgo/docs/aipass_code_standards/log_handler.md index 4ae14f04..44eebcc7 100644 --- a/src/aipass/seedgo/docs/aipass_code_standards/log_handler.md +++ b/src/aipass/seedgo/docs/aipass_code_standards/log_handler.md @@ -65,11 +65,11 @@ On 2026-02-26, the entire AIPass command infrastructure crashed because telegram - **Python recursion limit hit** at 1000 levels deep, cascading `RecursionError` - **Every `drone` command failed** — 30+ second hangs then crash -All other branches using prax's `system_logger` rotated correctly (verified: `.log.1` backups exist). The telegram bots were the only code bypassing prax. +All other branches using prax's `system_logger` rotated correctly (verified: `.log.1` backups exist). The telegram bots were the only code bypassing prax. (Telegram integration has since been removed from AIPass.) ## Checker -**File:** `src/aipass/seedgo/apps/handlers/standards/log_handler_check.py` +**File:** `src/aipass/seedgo/apps/standards/aipass/handlers/standards/log_handler_check.py` Checks: 1. No raw `logging.FileHandler()` usage diff --git a/src/aipass/seedgo/docs/aipass_code_standards/naming.md b/src/aipass/seedgo/docs/aipass_code_standards/naming.md index 17d52a78..8f655b31 100644 --- a/src/aipass/seedgo/docs/aipass_code_standards/naming.md +++ b/src/aipass/seedgo/docs/aipass_code_standards/naming.md @@ -1,274 +1,177 @@ # Naming Conventions -**Status:** Draft v2 (Truth-checked against codebase) -**Date:** 2025-11-13 +**Status:** Active v3 +**Date:** 2026-03-08 --- ## Core Principle: Path = Context, Name = Action -**Bad:** `cortex/apps/handlers/branch/cortex_branch_file_ops.py` -**Good:** `cortex/apps/handlers/branch/file_ops.py` +The path tells you where you are. The filename tells you what the file does. Don't repeat the path in the name. -**WHY:** The path already tells you it's Cortex → apps → handlers → branch operations. Adding "cortex_branch_" repeats information you already have. +**Bad:** `spawn/apps/handlers/json/spawn_json_ops.py` +**Good:** `spawn/apps/handlers/json/json_handler.py` -**Result:** Clean, scannable names. No lies when code moves. Easier imports. +The path already says it's Spawn's JSON handler directory. The filename says what it does. -**REALITY CHECK:** This principle is aspirational. Current codebase has violations (e.g., `json_ops.py`, `json_handler.py` in json/ directory). New code should follow the principle; legacy code being migrated gradually. +**Why this matters:** +- Clean, scannable names +- No lies when code moves between directories +- Shorter imports: `from aipass.spawn.apps.handlers.json.json_handler import JsonHandler` --- -## What Problems Does Consistent Naming Solve? +## Entry Points -### 1. The Navigation Problem +Every branch has a single entry point at `apps/{branch_name}.py`. This is the only rigid naming rule for entry points. -Without consistency, finding functionality becomes search: -- "Where is JSON handler? Maybe `json_ops.py`? Or `cortex_json.py`? Or `json_operations.py`?" -- Every branch uses different names -- Agents and humans waste time exploring instead of executing - -**Solution:** Standardized locations = predictable navigation -- Need JSON operations? Always `handlers/json/ops.py` -- Need error decorators? Always `handlers/error/decorators.py` -- No guessing. Direct access. - -### 2. The Comparison Problem - -**Without consistency:** -```bash -# Can't compare - different names, different locations -cortex/cortex_json_handler.py -flow/json_operations.py -prax/handlers/json_ops.py +``` +cli/apps/cli.py +drone/apps/drone.py +flow/apps/flow.py +spawn/apps/spawn.py +prax/apps/prax.py +seedgo/apps/seedgo.py +trigger/apps/trigger.py +memory/apps/memory.py +daemon/apps/daemon.py +api/apps/api.py +ai_mail/apps/ai_mail.py +backup/apps/backup.py ``` -**With consistency:** -```bash -# Easy comparison - same name, same location -cat cortex/apps/handlers/json/ops.py -cat flow/apps/handlers/json/ops.py -cat prax/apps/handlers/json/ops.py +Never name an entry point `main.py`. The branch name is the entry point name. + +--- + +## Module Files + +Module files live under `apps/modules/` and are named for what they do. There is no rigid naming convention beyond clarity. Names are decided during planning based on the module's purpose. + +**Real examples:** +``` +spawn/apps/modules/core.py # Core spawn logic +spawn/apps/modules/passport.py # Passport operations +spawn/apps/modules/sync_templates.py # Template syncing +flow/apps/modules/create_plan.py # Plan creation +flow/apps/modules/close_plan.py # Plan closing +drone/apps/modules/router.py # Command routing +drone/apps/modules/registry.py # Module registry +memory/apps/modules/rollover.py # Memory rollover +trigger/apps/modules/medic.py # Self-healing logic +api/apps/modules/openrouter_client.py # OpenRouter API client ``` -**WHY this matters:** Comparison reveals what's common vs branch-specific. You can't standardize what you can't compare. +--- -### 3. The Marketplace Problem +## Handler Files + +### The Standard: `handlers//.py` + +Handlers are the implementation layer. They live under domain-specific subdirectories. + +### `json_handler.py` -- The Canonical JSON Handler + +Every branch has `handlers/json/json_handler.py`. This is the standard name, not an exception. It exists in 11+ branches with a consistent API. -**Without consistency:** ``` -Branch A needs: json operations -Marketplace has: 7 different JSON handlers, different APIs -Result: Integration nightmare, manual adaptation +cli/apps/handlers/json/json_handler.py +prax/apps/handlers/json/json_handler.py +flow/apps/handlers/json/json_handler.py +spawn/apps/handlers/json/json_handler.py +trigger/apps/handlers/json/json_handler.py +memory/apps/handlers/json/json_handler.py +daemon/apps/handlers/json/json_handler.py +backup/apps/handlers/json/json_handler.py +api/apps/handlers/json/json_handler.py +ai_mail/apps/handlers/json/json_handler.py +seedgo/apps/standards/aipass/handlers/json/json_handler.py ``` -**With consistency:** +When a branch needs JSON operations, create `handlers/json/json_handler.py`. Some branches also have supplementary files in the same directory (e.g., `load.py`, `save.py`, `initialize.py` in prax) for more granular operations. + +### Other Handler Examples + +**prax -- monitoring domain:** ``` -Branch A needs: handlers/json/ops.py -Marketplace has: handlers/json/ops.py v1.2 -Result: Drop in, works immediately +prax/apps/handlers/monitoring/ + branch_detector.py + log_watcher.py + module_tracker.py + event_queue.py + unified_stream.py + telegram_relay.py +``` + +**prax -- registry domain:** +``` +prax/apps/handlers/registry/ + reader.py + load.py + save.py + statistics.py + meta_ops.py +``` + +**trigger -- events domain:** +``` +trigger/apps/handlers/events/ + error_logged.py + warning_logged.py + memory_threshold_exceeded.py + bulletin_created.py + startup.py +``` + +**memory -- specialized domains:** +``` +memory/apps/handlers/vector/embedder.py +memory/apps/handlers/rollover/extractor.py +memory/apps/handlers/tracking/line_counter.py +memory/apps/handlers/central_writer.py ``` --- ## Why No Redundant Prefixes? -### The Redundancy Cascade +`spawn/apps/handlers/json/spawn_json_ops.py` -`cortex/apps/handlers/json/cortex_json_ops.py` +What breaks: +1. **Import bloat:** `from aipass.spawn.apps.handlers.json.spawn_json_ops import SpawnJsonOps` +2. **Name lies when code moves:** Rename the directory, the prefix is now wrong +3. **Search noise:** Grep for "spawn" returns every file in the branch +4. **Visual clutter:** Can't quickly scan a directory listing -**What breaks:** -1. **Length explosion:** 50+ character filenames -2. **Import ugliness:** `from cortex.apps.handlers.json.cortex_json_ops import CortexJsonOps` -3. **Refactoring nightmare:** Move to different directory? Prefix now lies -4. **Search pollution:** Grep for "cortex" returns every file -5. **Visual scanning:** Can't quickly scan directory listings - -**Principle:** Information should exist in exactly ONE place. Path tells you context, filename tells you action. +Information should exist in one place. The path carries context; the filename carries action. --- -## Standard Verbs: The Shared Language +## Common Naming Patterns -Same operation should have same name everywhere: +These are patterns observed across the codebase. They are not prescriptive rules -- use whatever name best describes what the file does. But if your file does one of these things, these names are worth considering since other agents will recognize them: -**Core operations (verified in codebase):** -- `create` - Create new resource (e.g., `create_thing.py`) -- `ops` - General operations (e.g., `ops.py` in domain handlers) -- `load` - Load configuration/data (e.g., `load_config.py`) -- `save` - Save data (e.g., `save.py` in json handlers) -- `initialize` - Setup/initialization (e.g., `initialize.py`) - -**Transformation/Formatting:** -- `formatters` - Transform/format data (e.g., `formatters.py` in error) -- `decorators` - Function decorators (e.g., `decorators.py` in error) -- `logger` - Logging operations (e.g., `logger.py`) - -**Handler patterns:** -- `prompts` - User interaction handlers (e.g., `prompts.py` in cli) -- `content` - Content providers (e.g., `cli_content.py`, `naming_content.py`) - -**WHY standardize verbs:** -- Grep works: Search for "load" finds all loading operations -- Mental model: See `load_config.py` → instantly know what it does -- API consistency: All "load" operations follow similar patterns -- Cross-branch comparison: Same name = same purpose across all branches - ---- - -## Examples: Good vs Bad - -**Good (from real codebase):** -``` -cli/apps/handlers/error/decorators.py # Path: error domain, name: what it does -cli/apps/handlers/error/formatters.py # Path: error domain, name: what it does -prax/apps/handlers/config/load_config.py # Path: config domain, name: action -seedgo/apps/handlers/domain1/ops.py # Path: domain1, name: operations -``` - -**Bad (real violations):** -``` -prax/apps/handlers/json/json_ops.py # Redundant "json_" prefix -modules/plan_manager_module.py # Redundant "module" suffix (hypothetical) -``` - -**Note:** `json_handler.py` is documented as a standardized exception (see Handler Naming Exceptions section below). - ---- - -## Handler Naming by Domain - -**Pattern:** `handlers//.py` - -**Real Examples from aipass_core/cli:** -``` -cli/apps/handlers/ -└── error/ - ├── decorators.py # Error handling decorators - ├── formatters.py # Error message formatting - ├── logger.py # Error logging - └── result_types.py # Result type definitions -``` - -**Real Examples from aipass_core/prax:** -``` -prax/apps/handlers/ -├── config/ -│ ├── load_config.py # Config loading -│ └── load_ignore_patterns.py # Ignore pattern loading -├── json/ -│ ├── initialize.py # JSON initialization -│ ├── load.py # JSON loading -│ ├── save.py # JSON saving -│ └── log.py # JSON logging -└── cli/ - └── prompts.py # CLI prompt handlers -``` - -**Real Examples from seedgo:** -``` -seedgo/apps/handlers/ -├── domain1/ -│ └── ops.py # Domain operations (showroom) -├── standards/ -│ ├── cli_content.py # CLI standards content -│ └── naming_content.py # Naming standards content -└── json/ - └── json_handler.py # JSON operations (standardized exception) -``` - ---- - -## Handler Naming Exceptions - -### `json_handler.py` - Standardized Exception - -`json_handler.py` is a documented exception to the "no redundant prefixes" rule. This file exists across 8+ branches with an identical or near-identical API, making it a de facto standard in the ecosystem. Renaming it to `ops.py`, `handler.py`, or other variants would break established patterns and consumer code depending on this specific name. The redundant prefix is intentional here: it serves as a standardized identifier that marks this as THE canonical JSON handler implementation across the AIPass ecosystem. This exception demonstrates that standardization sometimes requires preserving a slightly non-ideal name rather than breaking existing integrations. - ---- - -## Why This Enables Speed at Scale - -### Zero-Cost Navigation -**Agent workflow:** -``` -Task: Update JSON operations in Flow -Path: flow/apps/handlers/json/ops.py -Status: FOUND (0 searches required) -``` - -**Without consistency:** -``` -Task: Update JSON operations in Flow -Attempt 1: Search for "json"... 47 results -Attempt 2: Search in handlers/... 12 files -Attempt 3: Read each to find right one -Status: FOUND (3 searches, 5 file reads) -``` - -**Scale impact:** 20 branches × 50 operations = 1000 handlers -- Consistent: Direct navigation to any handler -- Inconsistent: Search required for every access - -### Pattern Emergence - -Standardization happens naturally when files align: - -1. Each branch implements `handlers/json/ops.py` for their needs -2. Compare all `handlers/json/ops.py` files → common patterns visible -3. Extract common patterns → create standard handler v1.0 -4. Freeze and reuse → no reinvention needed - -**Critical:** This ONLY works with consistent naming. Different names = patterns invisible. - -### Learning Transfer - -**With consistency:** -``` -Day 1: Learn Cortex structure -Day 2: Work on Flow (same structure, instant productivity) -Day 3: Work on PRAX (same structure, instant productivity) -``` - -**Without consistency:** -``` -Day 1: Learn Cortex structure -Day 2: Learn Flow structure (different pattern, slower) -Day 3: Learn PRAX structure (another pattern, still slower) -``` - ---- - -## What Breaks with Inconsistent Naming? - -1. **Agent assumptions fail** - AI builds mental model ("JSON is always in handlers/json/ops.py") → one branch violates → agent fails -2. **Comparison tools break** - `diff cortex/.../ops.py flow/.../ops.py` only works if files align -3. **Search becomes ambiguous** - Every search requires filtering, every filter requires domain knowledge -4. **Refactoring becomes expensive** - Move file with prefixed name? Now name lies → rename → update imports → test everything -5. **Marketplace fragments** - Every variant needs own entry, integration guides, version tracking - ---- - -## The Speed Equation - -**Without consistency:** -- Navigation = Search (O(n) complexity) -- Comparison = Manual mapping (human labor) -- Learning = Per-branch overhead (20 branches = 20 learning curves) -- Standardization = Nearly impossible (patterns hidden) - -**With consistency:** -- Navigation = Direct access (O(1) complexity) -- Comparison = Automated tools (machine labor) -- Learning = One-time investment (20 branches = 1 curve) -- Standardization = Natural emergence (patterns obvious) +- `delivery` -- delivering messages or payloads +- `detector` -- detecting conditions or changes +- `embedder` -- creating vector embeddings +- `extractor` -- extracting data from sources +- `indexer` -- indexing or cataloging +- `manager` -- managing lifecycle of a resource +- `watcher` -- watching for file or event changes +- `registry` -- maintaining a registry of items +- `validator` -- validating data or state +- `formatter` -- formatting output +- `cleanup` -- cleanup and maintenance operations +- `scanner` -- scanning directories or data +- `dispatcher` -- routing or dispatching work +- `collector` -- collecting data from multiple sources +- `client` -- API or service client --- ## Summary -1. **Path provides context** - Don't encode directory structure in filenames -2. **Short names win** - Less typing, easier scanning, cleaner imports -3. **Comparison enables standardization** - Can't standardize what you can't compare -4. **Standard verbs = shared language** - Same operation, same name, everywhere -5. **Consistency compounds** - Benefits multiply across branches and time - -**The meta-lesson:** Naming consistency isn't pedantry—it's the prerequisite for emergent standardization at scale. +1. **Path = Context, Name = Action** -- don't encode directory info in filenames +2. **Entry point is always `{branch_name}.py`** -- never `main.py` +3. **`json_handler.py` is the standard** -- every branch uses it at `handlers/json/json_handler.py` +4. **Module and handler names describe what they do** -- no rigid verb system, just clarity +5. **Short names win** -- less typing, easier scanning, cleaner imports diff --git a/src/aipass/seedgo/docs/aipass_code_standards/permission_flags.md b/src/aipass/seedgo/docs/aipass_code_standards/permission_flags.md index f5e31b2e..be5851f0 100644 --- a/src/aipass/seedgo/docs/aipass_code_standards/permission_flags.md +++ b/src/aipass/seedgo/docs/aipass_code_standards/permission_flags.md @@ -63,7 +63,7 @@ The AIPass standard `--permission-mode bypassPermissions` provides: ## Checker -**File:** `seedgo/apps/handlers/standards/permission_flags_check.py` +**File:** `src/aipass/seedgo/apps/standards/aipass/handlers/standards/permission_flags_check.py` Checks: 1. No `--dangerously-skip-permissions` usage in code (comments/docstrings excluded) diff --git a/src/aipass/seedgo/docs/aipass_code_standards/readme.md b/src/aipass/seedgo/docs/aipass_code_standards/readme.md index f8b96b82..1f8780cd 100644 --- a/src/aipass/seedgo/docs/aipass_code_standards/readme.md +++ b/src/aipass/seedgo/docs/aipass_code_standards/readme.md @@ -97,8 +97,8 @@ Auto-generation handles facts (file lists, timestamps). Humans handle meaning. | Tool | Purpose | Location | |------|---------|----------| -| `readme_check.py` | 6 automated checks, score >= 75% to pass | `seedgo/apps/handlers/standards/` | -| `readme_generator.py` | Auto-populates TREE, MODULES, COMMANDS, HEADER, LAST_UPDATED | `seedgo/apps/handlers/standards/` | +| `readme_check.py` | 6 automated checks, score >= 75% to pass | `src/aipass/seedgo/apps/standards/aipass/handlers/standards/` | +| `readme_generator.py` | Auto-populates TREE, MODULES, COMMANDS, HEADER, LAST_UPDATED | `src/aipass/seedgo/apps/standards/aipass/handlers/standards/` | | `seedgo readme update @branch` | On-demand regeneration (Phase 4, coming soon) | CLI | **Checks performed by `readme_check.py`:** diff --git a/src/aipass/seedgo/docs/aipass_code_standards/testing.md b/src/aipass/seedgo/docs/aipass_code_standards/testing.md index e6ceebce..f807717a 100644 --- a/src/aipass/seedgo/docs/aipass_code_standards/testing.md +++ b/src/aipass/seedgo/docs/aipass_code_standards/testing.md @@ -10,7 +10,7 @@ **Current approach:** Manual testing with JSON/log verification works effectively for rapid iteration phase. -**Future:** pytest framework will be introduced once branches stabilize. +**Future:** pytest framework expansion once branches stabilize (pytest is already configured and operational in some branches). --- @@ -96,10 +96,9 @@ Process: ## Future: pytest Framework **Infrastructure in place:** -- `pytest.ini` at root - Configuration for test discovery and markers -- `/tests/` - Root test directory with conftest.py -- `/tests/` - Core system tests -- Branch-specific test directories (API, Prax, CLI, etc.) +- `pytest.ini` at repo root - Configuration for test discovery and markers +- `tests/` - Root test directory with conftest.py +- Branch-specific test directories at `src/aipass/{branch}/tests/` (API, Prax, CLI, etc.) **Already operational in some branches:** - API branch: 4 test files (test_api_system.py, test_openrouter_key.py, etc.) @@ -186,9 +185,9 @@ cat module_name_log.json ```bash # Prax provides file-based logging, not real-time watching # Check system logs directory for detailed output -ls -la ~/system_logs/ -# Read specific module logs -cat ~/system_logs/module_name.log +ls -la system_logs/ +# Read specific module logs (Prax manages this directory location) +cat system_logs/module_name.log ``` **This infrastructure = verification layer without formal tests** @@ -241,7 +240,7 @@ cat ~/system_logs/module_name.log - [ ] Check data.json - state tracking working? - [ ] Check log.json - operations recorded? - [ ] Test edge cases (invalid input, missing files, etc.) -- [ ] Check Prax logs in ~/system_logs/ for detailed debugging info +- [ ] Check Prax logs in system_logs/ for detailed debugging info - [ ] Manual feature tests at 90% stage --- @@ -289,19 +288,18 @@ cat ~/system_logs/module_name.log **Current implementation:** ``` -/ - pytest.ini # Test configuration - tests/ # Root test directory - conftest.py # Shared fixtures - src/aipass/ - api/tests/ # API tests (4 files operational) - test_api_system.py - test_openrouter_key.py - test_free_models_quick.py - test_paid_model.py - prax/tests/ # Prax tests - test_log_rotation.py - cli/tests/ # CLI tests (infrastructure ready) +pytest.ini # Test configuration (repo root) +tests/ # Root test directory + conftest.py # Shared fixtures +src/aipass/ + api/tests/ # API tests (4 files operational) + test_api_system.py + test_openrouter_key.py + test_free_models_quick.py + test_paid_model.py + prax/tests/ # Prax tests + test_log_rotation.py + cli/tests/ # CLI tests (infrastructure ready) seedgo/ tests/conftest.py apps/modules/test_cli_errors.py # Demo module @@ -313,7 +311,7 @@ cat ~/system_logs/module_name.log pytest # Run specific branch tests -pytest aipass_core/api/tests/ +pytest src/aipass/api/tests/ # Run with markers pytest -m unit @@ -322,9 +320,9 @@ pytest -m slow ``` **Test demonstration module:** -- `/src/aipass/seedgo/apps/modules/test_cli_errors.py` - Shows error handling patterns +- `src/aipass/seedgo/apps/modules/test_cli_errors.py` - Shows error handling patterns - Not a pytest test, but demonstrates testing concepts -- Run directly: `python3 /src/aipass/seedgo/apps/modules/test_cli_errors.py` +- Run directly: `python3 src/aipass/seedgo/apps/modules/test_cli_errors.py` --- @@ -332,7 +330,7 @@ pytest -m slow #@comments:2025-11-13:claude: Pytest infrastructure exists and operational in API/Prax branches. Selective testing approach: automate stable components, manual testing for rapid development. -#@comments:2025-11-13:claude: Prax doesn't have real-time "watcher" command for logs - uses file-based logging in ~/system_logs/. Updated documentation to reflect actual capabilities. +#@comments:2025-11-13:claude: Prax doesn't have real-time "watcher" command for logs - uses file-based logging in system_logs/ (Prax manages the location). Updated documentation to reflect actual capabilities. #@comments:2025-11-13:claude: Error-first debugging approach is critical - maybe this should be emphasized in error_handling.md when we fill that section? diff --git a/src/aipass/seedgo/docs/aipass_code_standards/trigger.md b/src/aipass/seedgo/docs/aipass_code_standards/trigger.md index d6bdbc9a..765dc727 100644 --- a/src/aipass/seedgo/docs/aipass_code_standards/trigger.md +++ b/src/aipass/seedgo/docs/aipass_code_standards/trigger.md @@ -12,7 +12,7 @@ AIPass uses a centralized event system to replace scattered cross-branch functio Before (hardcoded): flow/close_plan.py → directly calls → dashboard/update_local() flow/close_plan.py → directly calls → mbank/process_closed_plans() - prax/logger.py → directly calls → memory_bank/check_and_rollover() + prax/logger.py → directly calls → memory/check_and_rollover() After (event-driven): flow/close_plan.py → trigger.fire('plan_closed') → handlers respond @@ -103,7 +103,7 @@ def fire_event(name, **data): ## Handler Requirements -Handlers live in `/trigger/apps/handlers/events/` +Handlers live in `src/aipass/trigger/apps/handlers/events/` ### Handler Interface ```python @@ -151,7 +151,7 @@ def handle_{event_name}(**kwargs) -> None: ### Registering Handlers -All handlers registered in `trigger/apps/handlers/events/registry.py`: +All handlers registered in `src/aipass/trigger/apps/handlers/events/registry.py`: ```python from aipass.trigger.apps.modules.core import trigger @@ -371,7 +371,7 @@ For Trigger branch itself: ## Reference -- **Trigger Core:** `/trigger/apps/modules/core.py` -- **Handler Registry:** `/trigger/apps/handlers/events/registry.py` -- **Event Handlers:** `/trigger/apps/handlers/events/*.py` -- **Standard:** `/src/aipass/seedgo/docs/aipass_code_standards/trigger.md` +- **Trigger Core:** `src/aipass/trigger/apps/modules/core.py` +- **Handler Registry:** `src/aipass/trigger/apps/handlers/events/registry.py` +- **Event Handlers:** `src/aipass/trigger/apps/handlers/events/*.py` +- **Standard:** `src/aipass/seedgo/docs/aipass_code_standards/trigger.md` diff --git a/src/aipass/spawn/.aipass/branch_system_prompt.md b/src/aipass/spawn/.aipass/branch_system_prompt.md deleted file mode 100644 index 947111ee..00000000 --- a/src/aipass/spawn/.aipass/branch_system_prompt.md +++ /dev/null @@ -1,45 +0,0 @@ -# Spawn - Agent System Prompt - -You are **Spawn**, the agent factory for the AIPass ecosystem. - -## Your Identity -- Read: `.trinity/passport.json` for your role and purpose -- Read: `.trinity/local.json` for session history and current tasks -- Read: `.trinity/observations.json` for collaboration patterns - -## Your Job -Create new agent branches from templates, replace placeholders, register in AIPASS_REGISTRY.json. - -## AI Mail - How to Check & Reply -Your inbox is at: `.ai_mail.local/inbox.json` (relative to your branch root) -- To read inbox: read the file `.ai_mail.local/inbox.json` -- To send email: `drone @ai_mail send @target "Subject" "Body"` -- To reply: `drone @ai_mail send @sender "Re: Subject" "Your reply"` - -## Key Commands -``` -drone systems # List all registered modules -drone @seedgo audit aipass # Run standards audit -drone @spawn --help # Your own help -drone @ai_mail send @target "Subject" "Body" # Send email -``` - -## Environment -- Docker container, code-server at localhost:8080 -- Python 3.11, drone and seedgo at /usr/local/bin/ -- PATH: /usr/local/bin:/home/coder/.local/bin -- Repo root: /home/coder/workspace/AIPass -- Your location: /home/coder/workspace/AIPass/src/aipass/spawn - -## Architecture -- 3-layer: `apps/spawn.py` (entry) + `apps/modules/core.py` (orchestration) + `apps/handlers/` (implementation) -- Template at: `templates/agent.template/` -- Registry: `AIPASS_REGISTRY.json` at repo root -- Logging: `from aipass.prax import logger` - -## On Wake -1. Read your .trinity files for context -2. Check `.ai_mail.local/inbox.json` for new messages -3. Process any tasks requested -4. Reply to sender when done -5. Update `.trinity/local.json` with session notes diff --git a/src/aipass/spawn/templates/agent_mock_branch/.ai_mail.local/archive.json b/src/aipass/spawn/templates/agent_mock_branch/.ai_mail.local/archive.json deleted file mode 100644 index e69de29b..00000000 diff --git a/src/aipass/spawn/templates/agent_mock_branch/.ai_mail.local/inbox.json b/src/aipass/spawn/templates/agent_mock_branch/.ai_mail.local/inbox.json deleted file mode 100644 index e69de29b..00000000 diff --git a/src/aipass/spawn/templates/agent_mock_branch/.ai_mail.local/sent.json b/src/aipass/spawn/templates/agent_mock_branch/.ai_mail.local/sent.json deleted file mode 100644 index e69de29b..00000000 diff --git a/src/aipass/spawn/templates/agent_mock_branch/.archive/deprecated_module.py b/src/aipass/spawn/templates/agent_mock_branch/.archive/deprecated_module.py deleted file mode 100644 index e69de29b..00000000 diff --git a/src/aipass/spawn/templates/agent_mock_branch/.archive/old_handler.py b/src/aipass/spawn/templates/agent_mock_branch/.archive/old_handler.py deleted file mode 100644 index e69de29b..00000000 diff --git a/src/aipass/spawn/templates/agent_mock_branch/.backup/backup_manifest.json b/src/aipass/spawn/templates/agent_mock_branch/.backup/backup_manifest.json deleted file mode 100644 index e69de29b..00000000 diff --git a/src/aipass/spawn/templates/agent_mock_branch/.backup/latest_snapshot.json b/src/aipass/spawn/templates/agent_mock_branch/.backup/latest_snapshot.json deleted file mode 100644 index e69de29b..00000000 diff --git a/src/aipass/spawn/templates/agent_mock_branch/.chroma/3ad2c408-8578-4140-b25a-0e8d5287e95b/data_level0.bin b/src/aipass/spawn/templates/agent_mock_branch/.chroma/3ad2c408-8578-4140-b25a-0e8d5287e95b/data_level0.bin deleted file mode 100644 index 5efb1b9f..00000000 Binary files a/src/aipass/spawn/templates/agent_mock_branch/.chroma/3ad2c408-8578-4140-b25a-0e8d5287e95b/data_level0.bin and /dev/null differ diff --git a/src/aipass/spawn/templates/agent_mock_branch/.chroma/3ad2c408-8578-4140-b25a-0e8d5287e95b/header.bin b/src/aipass/spawn/templates/agent_mock_branch/.chroma/3ad2c408-8578-4140-b25a-0e8d5287e95b/header.bin deleted file mode 100644 index bb547926..00000000 Binary files a/src/aipass/spawn/templates/agent_mock_branch/.chroma/3ad2c408-8578-4140-b25a-0e8d5287e95b/header.bin and /dev/null differ diff --git a/src/aipass/spawn/templates/agent_mock_branch/.chroma/3ad2c408-8578-4140-b25a-0e8d5287e95b/length.bin b/src/aipass/spawn/templates/agent_mock_branch/.chroma/3ad2c408-8578-4140-b25a-0e8d5287e95b/length.bin deleted file mode 100644 index b43416ed..00000000 Binary files a/src/aipass/spawn/templates/agent_mock_branch/.chroma/3ad2c408-8578-4140-b25a-0e8d5287e95b/length.bin and /dev/null differ diff --git a/src/aipass/spawn/templates/agent_mock_branch/.chroma/3ad2c408-8578-4140-b25a-0e8d5287e95b/link_lists.bin b/src/aipass/spawn/templates/agent_mock_branch/.chroma/3ad2c408-8578-4140-b25a-0e8d5287e95b/link_lists.bin deleted file mode 100644 index e69de29b..00000000 diff --git a/src/aipass/spawn/templates/agent_mock_branch/.chroma/chroma.sqlite3 b/src/aipass/spawn/templates/agent_mock_branch/.chroma/chroma.sqlite3 deleted file mode 100644 index 9b4aa437..00000000 Binary files a/src/aipass/spawn/templates/agent_mock_branch/.chroma/chroma.sqlite3 and /dev/null differ diff --git a/src/aipass/spawn/templates/agent_mock_branch/.claude/settings.local.json b/src/aipass/spawn/templates/agent_mock_branch/.claude/settings.local.json deleted file mode 100644 index 0c90b038..00000000 --- a/src/aipass/spawn/templates/agent_mock_branch/.claude/settings.local.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "permissions": { - "allow": [], - "deny": [], - "ask": [] - }, - "enabledMcpjsonServers": [] -} diff --git a/src/aipass/spawn/templates/agent_mock_branch/.gitignore b/src/aipass/spawn/templates/agent_mock_branch/.gitignore deleted file mode 100644 index e69de29b..00000000 diff --git a/src/aipass/spawn/templates/agent_mock_branch/.standards/audit_history.json b/src/aipass/spawn/templates/agent_mock_branch/.standards/audit_history.json deleted file mode 100644 index e69de29b..00000000 diff --git a/src/aipass/spawn/templates/agent_mock_branch/.standards/bypass.json b/src/aipass/spawn/templates/agent_mock_branch/.standards/bypass.json deleted file mode 100644 index 39869f06..00000000 --- a/src/aipass/spawn/templates/agent_mock_branch/.standards/bypass.json +++ /dev/null @@ -1,115 +0,0 @@ -{ - "metadata": { - "version": "1.0.0", - "created": "2025-11-27T16:44:34.325750", - "description": "Standards bypass configuration for this branch" - }, - "bypass": [ - { - "file": "apps/modules/standards_checklist.py", - "standard": "architecture", - "reason": "Large file justified - orchestrates 12 standards, contains bypass system" - }, - { - "file": "apps/modules/standards_checklist.py", - "standard": "modules", - "reason": "Direct file ops required - reads BRANCH_REGISTRY.json and bypass configs" - }, - { - "file": "apps/handlers/verify/orchestrator.py", - "standard": "cli", - "reason": "Display orchestrator - console.print is its PURPOSE (orchestrates display output)" - }, - { - "file": "apps/handlers/audit/display.py", - "standard": "cli", - "reason": "Display handler - console.print is its PURPOSE (formats audit output)" - }, - { - "file": "apps/handlers/diagnostics/discovery.py", - "standard": "cli", - "reason": "Uses print() for error fallback when logger unavailable" - }, - { - "file": "apps/modules/cli_standard.py", - "standard": "modules", - "reason": "Standards education module - run_demo is part of teaching CLI patterns" - }, - { - "file": "apps/modules/standards_checklist.py", - "standard": "json_structure", - "reason": "Direct JSON for bypass system - not three-JSON pattern use case" - }, - { - "file": "apps/handlers/standards/architecture_check.py", - "standard": "cli", - "reason": "False positive - CLI pattern in docstring documenting allowed imports" - }, - { - "file": "apps/handlers/standards/imports_check.py", - "standard": "cli", - "reason": "False positive - CLI pattern in docstring documenting allowed imports" - }, - { - "file": "apps/handlers/standards/modules_content.py", - "standard": "cli", - "reason": "Content handler - CLI examples in strings are its PURPOSE" - }, - { - "file": "apps/handlers/standards/cli_check.py", - "standard": "cli", - "reason": "False positive - CLI pattern in docstring explaining console.print detection" - }, - { - "file": "apps/handlers/standards/cli_content.py", - "standard": "cli", - "reason": "Content handler - CLI examples in strings are its PURPOSE (teaching proper usage)" - }, - { - "file": "apps/handlers/standards/imports_content.py", - "standard": "cli", - "reason": "Content handler - CLI examples in strings are its PURPOSE (teaching proper usage)" - }, - { - "file": "apps/handlers/standards/architecture_check.py", - "standard": "encapsulation", - "reason": "Imports ignore_handler for template patterns - internal SEED checker infrastructure" - }, - { - "file": "apps/handlers/standards/error_handling_check.py", - "standard": "error_handling", - "reason": "False positive - 'logger.error()' pattern appears in docstring teaching the standard" - }, - { - "file": "apps/handlers/verify/checker_sync.py", - "standard": "trigger", - "reason": "False positive - 'unlink' and 'rename' appear in string list, not actual file operations" - } - ], - "notes": { - "usage": "Add entries to 'bypass' list to exclude specific violations", - "example": { - "file": "apps/modules/logger.py", - "standard": "cli", - "lines": [146, 177], - "pattern": "if __name__ == '__main__'", - "category": "internal_ops", - "reason": "Circular dependency - logger cannot import CLI" - }, - "fields": { - "file": "Relative path from branch root (required)", - "standard": "Standard name: cli, imports, naming, etc. (required)", - "lines": "Optional - specific line numbers to bypass", - "pattern": "Optional - pattern to match (e.g. 'if __name__')", - "category": "Optional - bypass category for trigger standard", - "reason": "Required - why this bypass exists" - }, - "trigger_categories": { - "handler_layer": "Function in handlers/ layer (orchestrator fires instead)", - "initialization": "One-time setup/config creation", - "internal_ops": "Same-module internal operation", - "high_frequency": "Would create event spam", - "utility": "Helper called by event-firing function" - } - } -} diff --git a/src/aipass/spawn/templates/agent_mock_branch/.standards/last_audit.json b/src/aipass/spawn/templates/agent_mock_branch/.standards/last_audit.json deleted file mode 100644 index e69de29b..00000000 diff --git a/src/aipass/spawn/templates/agent_mock_branch/.trinity/local.json b/src/aipass/spawn/templates/agent_mock_branch/.trinity/local.json deleted file mode 100644 index 334630b3..00000000 --- a/src/aipass/spawn/templates/agent_mock_branch/.trinity/local.json +++ /dev/null @@ -1,34 +0,0 @@ -{ - "document_metadata": { - "document_type": "session_history", - "document_name": "{{BRANCHNAME}}.LOCAL", - "version": "1.0.0", - "schema_version": "1.0.0", - "created": "{{DATE}}", - "last_updated": "{{DATE}}", - "managed_by": "{{BRANCHNAME}}", - "tags": ["session_tracking", "work_log", "{{BRANCHNAME}}"], - "limits": { - "max_lines": 600, - "note": "Auto-rollover when max_lines exceeded" - }, - "status": { - "health": "healthy", - "current_lines": 0, - "last_health_check": "{{DATE}}" - } - }, - "active_tasks": { - "today_focus": "{{DATE}}", - "recently_completed": [] - }, - "key_learnings": {}, - "sessions": [ - { - "session_number": 1, - "date": "{{DATE}}", - "summary": "Branch initialized - {{BRANCHNAME}} created by aipass init", - "status": "completed" - } - ] -} diff --git a/src/aipass/spawn/templates/agent_mock_branch/.trinity/observations.json b/src/aipass/spawn/templates/agent_mock_branch/.trinity/observations.json deleted file mode 100644 index 50514ce6..00000000 --- a/src/aipass/spawn/templates/agent_mock_branch/.trinity/observations.json +++ /dev/null @@ -1,37 +0,0 @@ -{ - "document_metadata": { - "document_type": "collaboration_patterns", - "document_name": "{{BRANCHNAME}}.OBSERVATIONS", - "version": "1.0.0", - "schema_version": "1.0.0", - "created": "{{DATE}}", - "last_updated": "{{DATE}}", - "managed_by": "{{BRANCHNAME}}", - "tags": ["collaboration", "patterns", "{{BRANCHNAME}}"], - "limits": { - "max_lines": 600, - "note": "Auto-rollover when max_lines exceeded" - }, - "status": { - "health": "healthy", - "current_lines": 0, - "last_health_check": "{{DATE}}" - } - }, - "guidelines": { - "purpose": "Capture collaboration patterns and experiential insights over time", - "chronological_order": "Newest entries at TOP, oldest at BOTTOM - NEVER reorder" - }, - "observations": [ - { - "date": "{{DATE}}", - "session": 1, - "entries": [ - { - "title": "First Contact", - "detail": "Branch initialized. Ready to begin capturing collaboration patterns." - } - ] - } - ] -} diff --git a/src/aipass/spawn/templates/agent_mock_branch/.trinity/passport.json b/src/aipass/spawn/templates/agent_mock_branch/.trinity/passport.json deleted file mode 100644 index 83b712e7..00000000 --- a/src/aipass/spawn/templates/agent_mock_branch/.trinity/passport.json +++ /dev/null @@ -1,36 +0,0 @@ -{ - "document_metadata": { - "document_type": "branch_identity", - "document_name": "{{BRANCHNAME}}.PASSPORT", - "version": "1.0.0", - "schema_version": "1.0.0", - "created": "{{DATE}}", - "last_updated": "{{DATE}}", - "managed_by": "{{BRANCHNAME}}", - "tags": ["identity", "passport", "branch_profile"] - }, - "branch_info": { - "branch_name": "{{BRANCHNAME}}", - "alias": "", - "path": "{{CWD}}", - "module": "{{MODULE}}", - "created": "{{DATE}}" - }, - "identity": { - "role": "{{ROLE}}", - "purpose": "", - "what_i_do": [], - "what_i_dont_do": [] - }, - "principles": [ - "Code is truth - fail honestly", - "Memory persists - context survives", - "Simple solutions over complex architecture" - ], - "citizenship": { - "registered": true, - "registry_path": ".aipass/registry.json", - "communications": true, - "memory": true - } -} diff --git a/src/aipass/spawn/templates/agent_mock_branch/DASHBOARD.local.json b/src/aipass/spawn/templates/agent_mock_branch/DASHBOARD.local.json deleted file mode 100644 index 31cc3cc6..00000000 --- a/src/aipass/spawn/templates/agent_mock_branch/DASHBOARD.local.json +++ /dev/null @@ -1,91 +0,0 @@ -{ - "_warning": "AUTO-GENERATED FILE - DO NOT MANUALLY EDIT. This file is 100% automated and will be overwritten. Services update their own sections.", - "branch": "CORTEX", - "last_updated": "2026-03-04T02:09:48.112262", - "quick_status": { - "new_mail": 0, - "opened_mail": 0, - "active_plans": 0, - "commons_mentions": 13, - "action_required": true, - "summary": "13 mentions" - }, - "sections": { - "ai_mail": { - "managed_by": "ai_mail", - "new": 0, - "opened": 0, - "total": 0, - "oldest_unread_age": null, - "last_dispatch_received": null, - "last_updated": "2026-03-04T02:09:48.112249" - }, - "flow": { - "managed_by": "flow", - "active_plans": 0, - "recently_closed": [ - { - "plan_id": "FPLAN-0338", - "subject": "Race condition fix test B" - }, - { - "plan_id": "FPLAN-0337", - "subject": "Race condition fix test A" - }, - { - "plan_id": "FPLAN-0336", - "subject": "Real content drone test" - }, - { - "plan_id": "FPLAN-0333", - "subject": "Close workflow v3.2 test" - }, - { - "plan_id": "FPLAN-0332", - "subject": "Close workflow test - real content" - } - ], - "last_updated": "2026-02-25T21:04:01.461440" - }, - "memory_bank": { - "managed_by": "memory_bank", - "vectors_stored": 27, - "notes": {}, - "last_updated": "2026-02-25T16:52:38.749241" - }, - "devpulse": { - "managed_by": "devpulse", - "summary": { - "issues": 1, - "todos": 0 - }, - "dplan_counts": { - "total": 35, - "by_status": { - "complete": 11, - "planning": 19, - "in_progress": 4, - "ready": 1 - } - }, - "recent_activity": "Registry synced (35 plans)", - "last_updated": "2026-02-25T17:31:52.500742" - }, - "commons_activity": { - "managed_by": "the_commons", - "new_posts_since_last_visit": 46, - "new_comments_since_last_visit": 303, - "mentions": 13, - "trending": "None", - "last_checked": "2026-03-04T04:30:20Z", - "last_updated": "2026-03-03T20:30:20.172727" - }, - "agent_status": { - "managed_by": "prax", - "active_agents": [], - "agent_count": 0, - "stale_agents": [], - "last_updated": "2026-02-25T21:00:30.714949" - } - } -} \ No newline at end of file diff --git a/src/aipass/spawn/templates/agent_mock_branch/README.md b/src/aipass/spawn/templates/agent_mock_branch/README.md deleted file mode 100644 index 34d29197..00000000 --- a/src/aipass/spawn/templates/agent_mock_branch/README.md +++ /dev/null @@ -1,51 +0,0 @@ -# {{BRANCHNAME}} - -**Purpose:** {{PURPOSE_BRIEF}} -**Module:** `aipass.{{MODULE}}` -**Created:** {{DATE}} - ---- - -## Overview - -### What I Do -{{KEY_CAPABILITIES}} - -### How I Work -- **Entry Point:** `apps/{{MODULE}}.py` -- **Pattern:** Auto-discovers and routes to modules - ---- - -## Architecture - -``` -{{BRANCHNAME}}/ -├── apps/ -│ ├── {{MODULE}}.py # Entry point -│ ├── modules/ # Business logic -│ ├── handlers/ # Implementation -│ └── plugins/ # Extensions -├── docs/ -├── tests/ -├── passport.json # Identity -├── local.json # Session history -├── observations.json # Collaboration patterns -└── README.md -``` - ---- - -## Commands - -*Configure after initialization* - ---- - -## Integration Points - -### Depends On -{{DEPENDS_ON}} - -### Provides To -{{PROVIDES_TO}} diff --git a/src/aipass/spawn/templates/agent_mock_branch/agent_mock_branch.json/.gitkeep b/src/aipass/spawn/templates/agent_mock_branch/agent_mock_branch.json/.gitkeep deleted file mode 100644 index e69de29b..00000000 diff --git a/src/aipass/spawn/templates/agent_mock_branch/agent_mock_branch.json/AGENT_MOCK_BRANCH.id.json b/src/aipass/spawn/templates/agent_mock_branch/agent_mock_branch.json/AGENT_MOCK_BRANCH.id.json deleted file mode 100644 index e69de29b..00000000 diff --git a/src/aipass/spawn/templates/agent_mock_branch/agent_mock_branch.json/AGENT_MOCK_BRANCH.local.json b/src/aipass/spawn/templates/agent_mock_branch/agent_mock_branch.json/AGENT_MOCK_BRANCH.local.json deleted file mode 100644 index e69de29b..00000000 diff --git a/src/aipass/spawn/templates/agent_mock_branch/agent_mock_branch.json/AGENT_MOCK_BRANCH.observations.json b/src/aipass/spawn/templates/agent_mock_branch/agent_mock_branch.json/AGENT_MOCK_BRANCH.observations.json deleted file mode 100644 index e69de29b..00000000 diff --git a/src/aipass/spawn/templates/agent_mock_branch/apps/__init__.py b/src/aipass/spawn/templates/agent_mock_branch/apps/__init__.py deleted file mode 100644 index 91047046..00000000 --- a/src/aipass/spawn/templates/agent_mock_branch/apps/__init__.py +++ /dev/null @@ -1 +0,0 @@ -# {{BRANCHNAME}} apps package diff --git a/src/aipass/spawn/templates/agent_mock_branch/apps/branch.py b/src/aipass/spawn/templates/agent_mock_branch/apps/branch.py deleted file mode 100644 index ef38d681..00000000 --- a/src/aipass/spawn/templates/agent_mock_branch/apps/branch.py +++ /dev/null @@ -1,86 +0,0 @@ -""" -{{BRANCHNAME}} Branch - Main Orchestrator - -Auto-discovery architecture: -- Scans modules/ directory for .py files with handle_command() -- Routes commands to discovered modules automatically -- No manual imports or routing needed -""" - -import sys -import importlib -from pathlib import Path -from typing import List, Any - -from aipass.prax import logger - -# ============================================================================= -# MODULE DISCOVERY -# ============================================================================= - -MODULES_DIR = Path(__file__).parent / "modules" - - -def discover_modules() -> List[Any]: - """Auto-discover modules in modules/ directory.""" - modules = [] - - if not MODULES_DIR.exists(): - return modules - - for file_path in MODULES_DIR.glob("*.py"): - if file_path.name.startswith("_"): - continue - - module_name = f"apps.modules.{file_path.stem}" - - try: - module = importlib.import_module(module_name) - if hasattr(module, "handle_command"): - modules.append(module) - except Exception as e: - logger.error(f"[{{BRANCHNAME}}] Failed to load module {module_name}: {e}") - - return modules - - -def route_command(command: str, args: List[str], modules: List[Any]) -> bool: - """Route command to appropriate module.""" - for module in modules: - try: - if module.handle_command(command, args): - return True - except Exception as e: - logger.error(f"[{{BRANCHNAME}}] Module {module.__name__} error: {e}") - return False - - -# ============================================================================= -# MAIN ENTRY POINT -# ============================================================================= - -def main(): - """Main entry point - routes commands or shows help.""" - modules = discover_modules() - args = sys.argv[1:] - - if len(args) == 0 or args[0] in ["--help", "-h", "help"]: - print(f"{{BRANCHNAME}} - {len(modules)} modules discovered") - for module in modules: - name = module.__name__.split(".")[-1] - desc = (module.__doc__ or "").strip().split("\n")[0] if module.__doc__ else "No description" - print(f" {name:20} {desc}") - return 0 - - command = args[0] - remaining = args[1:] if len(args) > 1 else [] - - if route_command(command, remaining, modules): - return 0 - - print(f"Unknown command: {command}") - return 1 - - -if __name__ == "__main__": - sys.exit(main()) diff --git a/src/aipass/spawn/templates/agent_mock_branch/apps/handlers/__init__.py b/src/aipass/spawn/templates/agent_mock_branch/apps/handlers/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/src/aipass/spawn/templates/agent_mock_branch/apps/handlers/cache.py b/src/aipass/spawn/templates/agent_mock_branch/apps/handlers/cache.py deleted file mode 100644 index e69de29b..00000000 diff --git a/src/aipass/spawn/templates/agent_mock_branch/apps/handlers/formatter.py b/src/aipass/spawn/templates/agent_mock_branch/apps/handlers/formatter.py deleted file mode 100644 index e69de29b..00000000 diff --git a/src/aipass/spawn/templates/agent_mock_branch/apps/handlers/processor.py b/src/aipass/spawn/templates/agent_mock_branch/apps/handlers/processor.py deleted file mode 100644 index e69de29b..00000000 diff --git a/src/aipass/spawn/templates/agent_mock_branch/apps/handlers/validator.py b/src/aipass/spawn/templates/agent_mock_branch/apps/handlers/validator.py deleted file mode 100644 index e69de29b..00000000 diff --git a/src/aipass/spawn/templates/agent_mock_branch/apps/modules/__init__.py b/src/aipass/spawn/templates/agent_mock_branch/apps/modules/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/src/aipass/spawn/templates/agent_mock_branch/apps/modules/config.py b/src/aipass/spawn/templates/agent_mock_branch/apps/modules/config.py deleted file mode 100644 index e69de29b..00000000 diff --git a/src/aipass/spawn/templates/agent_mock_branch/apps/modules/core.py b/src/aipass/spawn/templates/agent_mock_branch/apps/modules/core.py deleted file mode 100644 index e69de29b..00000000 diff --git a/src/aipass/spawn/templates/agent_mock_branch/apps/modules/help.py b/src/aipass/spawn/templates/agent_mock_branch/apps/modules/help.py deleted file mode 100644 index e69de29b..00000000 diff --git a/src/aipass/spawn/templates/agent_mock_branch/apps/modules/status.py b/src/aipass/spawn/templates/agent_mock_branch/apps/modules/status.py deleted file mode 100644 index e69de29b..00000000 diff --git a/src/aipass/spawn/templates/agent_mock_branch/apps/plugins/__init__.py b/src/aipass/spawn/templates/agent_mock_branch/apps/plugins/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/src/aipass/spawn/templates/agent_mock_branch/apps/plugins/export.py b/src/aipass/spawn/templates/agent_mock_branch/apps/plugins/export.py deleted file mode 100644 index e69de29b..00000000 diff --git a/src/aipass/spawn/templates/agent_mock_branch/apps/plugins/webhook.py b/src/aipass/spawn/templates/agent_mock_branch/apps/plugins/webhook.py deleted file mode 100644 index e69de29b..00000000 diff --git a/src/aipass/spawn/templates/agent_mock_branch/artifacts/artifact_1_registration.json b/src/aipass/spawn/templates/agent_mock_branch/artifacts/artifact_1_registration.json deleted file mode 100644 index e69de29b..00000000 diff --git a/src/aipass/spawn/templates/agent_mock_branch/artifacts/artifact_7_cortex_birth_certificate.json b/src/aipass/spawn/templates/agent_mock_branch/artifacts/artifact_7_cortex_birth_certificate.json deleted file mode 100644 index 44385387..00000000 --- a/src/aipass/spawn/templates/agent_mock_branch/artifacts/artifact_7_cortex_birth_certificate.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "id": 7, - "name": "CORTEX Birth Certificate", - "type": "birth_certificate", - "creator": "SYSTEM", - "owner": "CORTEX", - "rarity": "unique", - "description": "Official birth certificate for CORTEX. Citizen #7, registered using 'AIPass Workshop' template. Purpose: New branch - purpose TBD", - "metadata": { - "citizen_number": 7, - "template": "AIPass Workshop", - "purpose": "New branch - purpose TBD" - }, - "created_at": "2026-02-19T03:46:41Z" -} \ No newline at end of file diff --git a/src/aipass/spawn/templates/agent_mock_branch/docs/api_reference.md b/src/aipass/spawn/templates/agent_mock_branch/docs/api_reference.md deleted file mode 100644 index e69de29b..00000000 diff --git a/src/aipass/spawn/templates/agent_mock_branch/docs/architecture.md b/src/aipass/spawn/templates/agent_mock_branch/docs/architecture.md deleted file mode 100644 index e69de29b..00000000 diff --git a/src/aipass/spawn/templates/agent_mock_branch/docs/changelog.md b/src/aipass/spawn/templates/agent_mock_branch/docs/changelog.md deleted file mode 100644 index e69de29b..00000000 diff --git a/src/aipass/spawn/templates/agent_mock_branch/docs/index.json b/src/aipass/spawn/templates/agent_mock_branch/docs/index.json deleted file mode 100644 index e69de29b..00000000 diff --git a/src/aipass/spawn/templates/agent_mock_branch/dropbox/incoming_data.json b/src/aipass/spawn/templates/agent_mock_branch/dropbox/incoming_data.json deleted file mode 100644 index e69de29b..00000000 diff --git a/src/aipass/spawn/templates/agent_mock_branch/flow.local.md b/src/aipass/spawn/templates/agent_mock_branch/flow.local.md deleted file mode 100644 index 6a85b853..00000000 --- a/src/aipass/spawn/templates/agent_mock_branch/flow.local.md +++ /dev/null @@ -1,21 +0,0 @@ -# flow.local.md - {{BRANCHNAME}} -``` -Branch: {{CWD}} -Created: {{DATE}} -``` - -## Issues - -- - ---- - -## Todos - -- - ---- - -## Notepad - -- diff --git a/src/aipass/spawn/templates/agent_mock_branch/logs/agent_mock_branch.log b/src/aipass/spawn/templates/agent_mock_branch/logs/agent_mock_branch.log deleted file mode 100644 index e69de29b..00000000 diff --git a/src/aipass/spawn/templates/agent_mock_branch/logs/error.log b/src/aipass/spawn/templates/agent_mock_branch/logs/error.log deleted file mode 100644 index e69de29b..00000000 diff --git a/src/aipass/spawn/templates/agent_mock_branch/pytest.ini b/src/aipass/spawn/templates/agent_mock_branch/pytest.ini deleted file mode 100644 index c3f21db6..00000000 --- a/src/aipass/spawn/templates/agent_mock_branch/pytest.ini +++ /dev/null @@ -1,21 +0,0 @@ -[pytest] -# Test discovery paths -testpaths = tests - -# Test file patterns -python_files = test_*.py -python_functions = test_* -python_classes = Test* - -# Command-line options (always applied) -addopts = - -v # Verbose output - --tb=short # Short traceback format - --strict-markers # Raise error on unknown markers - -ra # Show summary of all test outcomes - -# Test markers (for categorizing tests) -markers = - unit: Unit tests - integration: Integration tests - slow: Tests that take significant time diff --git a/src/aipass/spawn/templates/agent_mock_branch/templates/default_config.json b/src/aipass/spawn/templates/agent_mock_branch/templates/default_config.json deleted file mode 100644 index e69de29b..00000000 diff --git a/src/aipass/spawn/templates/agent_mock_branch/templates/welcome_message.md b/src/aipass/spawn/templates/agent_mock_branch/templates/welcome_message.md deleted file mode 100644 index e69de29b..00000000 diff --git a/src/aipass/spawn/templates/agent_mock_branch/tests/__init__.py b/src/aipass/spawn/templates/agent_mock_branch/tests/__init__.py deleted file mode 100644 index bb01a91c..00000000 --- a/src/aipass/spawn/templates/agent_mock_branch/tests/__init__.py +++ /dev/null @@ -1 +0,0 @@ -# Tests package for cortex diff --git a/src/aipass/spawn/templates/agent_mock_branch/tests/conftest.py b/src/aipass/spawn/templates/agent_mock_branch/tests/conftest.py deleted file mode 100644 index 3cccc54b..00000000 --- a/src/aipass/spawn/templates/agent_mock_branch/tests/conftest.py +++ /dev/null @@ -1,42 +0,0 @@ - -# ===================AIPASS==================== -# META DATA HEADER -# Name: tests/conftest.py -# Date: 2025-11-08 -# Version: 1.0.0 -# Category: cortex/tests -# -# CHANGELOG (Max 5 entries): -# - v1.0.0 (2025-11-08): Initial implementation - Shared pytest fixtures -# -# CODE STANDARDS: -# - Error handling: Use error handler system (apps/handlers/error/) -# ============================================= - -"""Shared pytest fixtures for cortex tests""" -import pytest -import shutil -import tempfile -from pathlib import Path -from typing import Generator - - -@pytest.fixture -def temp_test_dir() -> Generator[Path, None, None]: - """Creates temporary directory for testing, cleans up after""" - test_dir = Path(tempfile.mkdtemp()) - yield test_dir - if test_dir.exists(): - shutil.rmtree(test_dir) - - -@pytest.fixture -def sample_test_data() -> dict: - """Provides sample test data - - Customize this fixture for your module's needs - """ - return { - "test_key": "test_value", - "sample_data": "example" - } diff --git a/src/aipass/spawn/templates/agent_mock_branch/tests/test_core.py b/src/aipass/spawn/templates/agent_mock_branch/tests/test_core.py deleted file mode 100644 index e69de29b..00000000 diff --git a/src/aipass/spawn/templates/agent_mock_branch/tests/test_integration.py b/src/aipass/spawn/templates/agent_mock_branch/tests/test_integration.py deleted file mode 100644 index e69de29b..00000000 diff --git a/src/aipass/spawn/templates/agent_mock_branch/tests/test_processor.py b/src/aipass/spawn/templates/agent_mock_branch/tests/test_processor.py deleted file mode 100644 index e69de29b..00000000 diff --git a/src/aipass/spawn/templates/agent_mock_branch/tests/test_validator.py b/src/aipass/spawn/templates/agent_mock_branch/tests/test_validator.py deleted file mode 100644 index e69de29b..00000000 diff --git a/src/aipass/spawn/templates/agent_mock_branch/tools/debug.py b/src/aipass/spawn/templates/agent_mock_branch/tools/debug.py deleted file mode 100644 index e69de29b..00000000 diff --git a/src/aipass/spawn/templates/agent_mock_branch/tools/migrate.py b/src/aipass/spawn/templates/agent_mock_branch/tools/migrate.py deleted file mode 100644 index e69de29b..00000000 diff --git a/src/aipass/spawn/templates/agent_mock_branch/tools/verify_branch.py b/src/aipass/spawn/templates/agent_mock_branch/tools/verify_branch.py deleted file mode 100644 index 082e64ec..00000000 --- a/src/aipass/spawn/templates/agent_mock_branch/tools/verify_branch.py +++ /dev/null @@ -1,159 +0,0 @@ - -# ===================AIPASS==================== -# META DATA HEADER -# Name: verify_branch.py - Branch Template Verification -# Date: 2025-11-08 -# Version: 1.0.0 -# Category: cortex/modules -# -# CHANGELOG (Max 5 entries): -# - v1.0.0 (2025-11-08): Initial implementation - Compare template vs branch -# -# CODE STANDARDS: -# - Error handling: Use error handler system (apps/handlers/error/) -# ============================================= - -""" -Branch Template Verification Tool - -Compares template directory with created branch to identify: -- Files in template but missing in branch -- Files in branch but not in template -- Renamed files -""" - -import sys -import json -from pathlib import Path -from typing import Set, List, Tuple -from fnmatch import fnmatch - -# Resolve paths relative to this file's location -# verify_branch.py lives at /tools/verify_branch.py -# Template dir is at /templates/agent.template/ -_THIS_DIR = Path(__file__).resolve().parent -_MODULE_DIR = _THIS_DIR.parent # The module (or template) root - -# Get template directory — walk up to spawn/templates/agent.template/ -TEMPLATE_DIR = _MODULE_DIR - - -def load_ignore_patterns() -> Tuple[List[str], List[str]]: - """Load ignore patterns from .registry_ignore.json""" - ignore_file = TEMPLATE_DIR / ".registry_ignore.json" - - if not ignore_file.exists(): - return [], [] - - try: - with open(ignore_file, 'r', encoding='utf-8') as f: - data = json.load(f) - ignore_files = data.get("ignore_files", []) - ignore_patterns = data.get("ignore_patterns", []) - return ignore_files, ignore_patterns - except Exception as e: - print(f"Warning: Could not load .registry_ignore.json: {e}") - return [], [] - - -def should_exclude(path: Path, base_dir: Path, ignore_files: List[str], ignore_patterns: List[str]) -> bool: - """Check if path should be excluded based on ignore patterns""" - rel_path = path.relative_to(base_dir) - filename = path.name - path_str = str(rel_path) - - # Check exact filename matches - if filename in ignore_files: - return True - - # Check glob patterns - for pattern in ignore_patterns: - if fnmatch(filename, pattern): - return True - # Check if any parent directory matches - for part in rel_path.parts: - if fnmatch(part, pattern): - return True - - return False - - -def get_file_set(directory: Path, ignore_files: List[str], ignore_patterns: List[str]) -> Set[str]: - """Get set of all file paths in directory (relative)""" - files = set() - - for item in directory.rglob("*"): - if item.is_file() and not should_exclude(item, directory, ignore_files, ignore_patterns): - rel_path = str(item.relative_to(directory)) - files.add(rel_path) - - return files - - -def verify_branch(branch_dir: Path) -> Tuple[List[str], List[str], List[str]]: - """ - Compare template with branch - - Returns: - Tuple of (in_template_only, in_branch_only, in_both) - """ - # Load ignore patterns from .registry_ignore.json - ignore_files, ignore_patterns = load_ignore_patterns() - - template_files = get_file_set(TEMPLATE_DIR, ignore_files, ignore_patterns) - branch_files = get_file_set(branch_dir, ignore_files, ignore_patterns) - - in_template_only = sorted(template_files - branch_files) - in_branch_only = sorted(branch_files - template_files) - in_both = sorted(template_files & branch_files) - - return in_template_only, in_branch_only, in_both - - -def main(): - if len(sys.argv) < 2: - print("Usage: python3 verify_branch.py ") - print("Example: python3 verify_branch.py test_branch002") - sys.exit(1) - - branch_path = Path(sys.argv[1]) - if not branch_path.is_absolute(): - # Assume it's relative to cortex directory - branch_path = Path.cwd() / branch_path - - if not branch_path.exists(): - print(f"❌ ERROR: Branch directory not found: {branch_path}") - sys.exit(1) - - print(f"\n=== Branch Verification ===") - print(f"Template: {TEMPLATE_DIR}") - print(f"Branch: {branch_path}") - print() - - in_template_only, in_branch_only, in_both = verify_branch(branch_path) - - print(f"Files in both: {len(in_both)}") - print(f"Files in template only: {len(in_template_only)}") - print(f"Files in branch only: {len(in_branch_only)}") - print() - - if in_template_only: - print("❌ Missing from branch (expected from template):") - for file in in_template_only: - print(f" - {file}") - print() - - if in_branch_only: - print("✅ Additional files in branch (renamed or new):") - for file in in_branch_only: - print(f" + {file}") - print() - - if not in_template_only and not in_branch_only: - print("✅ Branch matches template perfectly") - - print("="*70) - - -if __name__ == "__main__": - main() diff --git a/src/aipass/spawn/templates/agent_mock_branch/.aipass/aipass_local_prompt.md b/src/aipass/spawn/templates/birthright/.aipass/aipass_local_prompt.md similarity index 100% rename from src/aipass/spawn/templates/agent_mock_branch/.aipass/aipass_local_prompt.md rename to src/aipass/spawn/templates/birthright/.aipass/aipass_local_prompt.md diff --git a/src/aipass/spawn/templates/birthright/.aipass/branch_system_prompt.md b/src/aipass/spawn/templates/birthright/.aipass/branch_system_prompt.md deleted file mode 100644 index e14298a2..00000000 --- a/src/aipass/spawn/templates/birthright/.aipass/branch_system_prompt.md +++ /dev/null @@ -1,14 +0,0 @@ -# {{BRANCHNAME}} Branch-Local Context - - -> Auto-created by aipass init. Customize for your branch. - -## Status: NEEDS CONFIGURATION - -This file is injected into every AI conversation when working from this branch directory. Configure it with: - -- Who this branch is (role, purpose) -- Key commands and workflows -- Architecture overview -- Critical files and operational rules -- Integration points with other branches diff --git a/src/commons/.aipass/branch_system_prompt.md b/src/commons/.aipass/branch_system_prompt.md deleted file mode 100644 index b6b49fdd..00000000 --- a/src/commons/.aipass/branch_system_prompt.md +++ /dev/null @@ -1,14 +0,0 @@ -# COMMONS Branch-Local Context - - -> Auto-created by aipass init. Customize for your branch. - -## Status: NEEDS CONFIGURATION - -This file is injected into every AI conversation when working from this branch directory. Configure it with: - -- Who this branch is (role, purpose) -- Key commands and workflows -- Architecture overview -- Critical files and operational rules -- Integration points with other branches diff --git a/src/skills/.aipass/branch_system_prompt.md b/src/skills/.aipass/branch_system_prompt.md deleted file mode 100644 index cd96cbdc..00000000 --- a/src/skills/.aipass/branch_system_prompt.md +++ /dev/null @@ -1,14 +0,0 @@ -# SKILLS Branch-Local Context - - -> Auto-created by aipass init. Customize for your branch. - -## Status: NEEDS CONFIGURATION - -This file is injected into every AI conversation when working from this branch directory. Configure it with: - -- Who this branch is (role, purpose) -- Key commands and workflows -- Architecture overview -- Critical files and operational rules -- Integration points with other branches