Skip to content

feat: AIOS Phase 1 — 3D tridimensional architecture + gitignore foundation + pre-commit audit#20

Merged
thiagofinch merged 35 commits intomainfrom
setup/aios-phase1-gitignore-foundation
Mar 6, 2026
Merged

feat: AIOS Phase 1 — 3D tridimensional architecture + gitignore foundation + pre-commit audit#20
thiagofinch merged 35 commits intomainfrom
setup/aios-phase1-gitignore-foundation

Conversation

@thiagofinch
Copy link
Owner

Summary

  • 3D Tridimensional Architecture: Restructured knowledge/ into 3 buckets: external/ (expert), workspace/ (business), personal/ (cognitive L3)
  • Pre-commit Layer Audit Hook: New .claude/hooks/pre_commit_audit.py blocks NEVER files and secrets at commit time, warns on L3 leaks and template staleness
  • Gitignore Foundation: Whitelist architecture (* + !path), untrack personal names/brands, remove .DS_Store and __pycache__
  • Ruff Formatting: Import sorting + modern type hints across 73 Python files
  • Agent Updates: 28 agent files updated for new knowledge/external/ paths, 14 DNA-CONFIG.yaml migrated

Commits (8)

  1. ceaf7904 — chore: framework setup phase 1
  2. 431e08e2feat(architecture): implement Mega Brain 3D tridimensional structure (214 files)
  3. 4c8913b3 — feat(logs): branded log templates
  4. 5df657df — fix(agents): update 28 agent files with stale knowledge/SOURCES/ refs
  5. 86b0085a — feat(bin): add colored ASCII log header script
  6. 60249a4f — fix(gitignore): remove personal names and brand refs
  7. 9cfef4df — style: ruff format (73 files)
  8. a5c0e221 — chore: remove pycache from tracking

Test plan

  • Pre-commit hook blocks .env (NEVER layer) — verified
  • Pre-commit hook passes clean L1 commits — verified
  • Pre-commit hook bypass works (MEGA_BRAIN_LAYER_PUSH=true) — verified
  • classify_path() import works from hook context
  • bin/install-hooks.js creates correct symlink
  • All Python scripts import correctly with new paths

🤖 Generated with Claude Code

thiagofinch and others added 30 commits March 2, 2026 11:59
MOD-001: Agent memory hooks now read/write to canonical agent directories
(agents/cargo/*, agents/minds/*, etc.) via AGENT-INDEX.yaml resolver,
instead of the non-existent .claude/agent-memory/ directory.
This connects the MIS (Memory Integration System) to the actual rich
memory files (up to 1600+ lines) that batch cascading writes.

MOD-002: Move 3 orphan hooks (ledger_updater, notification_system,
session-source-sync) to archive/hooks-unused/ — confirmed zero references
in settings.json and zero imports from other hooks.

Protocol: *doctor → *analyze-impact → *propose-modification → execution

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
MOD-003: claude_md_guard.py was orienting agents to .claude/agent-memory/
which doesn't exist. Updated 3 message strings to point to the real
canonical location: agents/{path}/MEMORY.md via AGENT-INDEX.yaml.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
New session_index.py creates unique UUID per session and maintains
cross-reference INDEX.json. continuous_save.py updated to v1.1 with
UUID integration. Resume skill updated to read session UUIDs.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Phase 1: chunker + hybrid_index + hybrid_query (BM25+RRF, 2619 chunks)
Phase 2: evaluator (quality scoring)
Phase 3: graph_builder + ontology_layer + associative_memory (GraphRAG)
Phase 4: graph_query (classification + fusion)
Phase 5: adaptive_router (5 pipelines) + self_rag + mcp_server (5 tools)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
query_analyzer.py - Domain taxonomy and agent discovery
context_assembler.py - Section scoring and budget trimming (91.6% reduction)
memory_splitter.py - Memory splitting for large agent files
dossier_tracer.py - Dossier tracing across knowledge base
nav_map_builder.py - Navigation map building for agents

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
conclave.md, debate.md - Added Smart Context Assembly pre-step
process-jarvis.md - Updated RAG rebuild commands (Phase 8)
rag-search.md - Complete rewrite for 5-pipeline RAG system
PIPELINE-JARVIS-DOCS.md - Updated RAG references

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
bin/installer.js, bin/pro-detector.js - Updated agent path references
gemini_fetch.py - File mode normalization (755→644)
docs/conselho.md, docs/pipeline-completa-v4.md - Moved to research/ (L3)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…missing timeouts

- Add processing/ and .gitignore.local to .gitignore (P0: 115 files exposed)
- Fix post_batch_cascading.py PROJECT_DIR fallback from '.' to absolute path
  (root cause of ghost directories under logs/batches/)
- Remove stale SCRIPTS/ reference in inbox_age_alert.py (folder was deleted)
- Add timeout: 10000 to gsd-check-update.js and gsd-context-monitor.js hooks
  (ANTHROPIC-STANDARDS § 1.1 compliance)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Includes AIOS/, Ralph/, bilhon-docs/, close-loop/, desktop, doc-master/,
extract-knowledge/, greet, loops/, map/, merge-aios, mmos-squad/,
mmosMapper/, pipeline-heal, resume/, save/, sessions/, synapse/.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Includes agent-creation, knowledge-extraction, pipeline-jarvis,
verification, architect-first, clone-mind, course-generation,
enhance-workflow, mcp-builder, pipeline-heal, process-bilhon-inbox,
ralph, skill-creator, squad, synapse, teaching.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
semantic-routing, architecture-rules, agent-commands-rules,
aios-native-knowledge, mcp-usage.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…ttings update

pending_tracker: expanded tracking logic
post_tool_use: major improvements (+107 lines)
skill_router: keyword additions
settings.json: new hook configs + backup pre-migration

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- CLAUDE.md: expanded architecture docs (+206 lines)
- gitignore/npmignore: new exclusion patterns
- AGENT-INDEX: new agent entries
- pre-publish-gate: additional validation rules
- dossiers/_INDEX: updated index
- Added: API-KEYS-GUIDE, supabase-setup.sql, pipeline_heal.py
- Added: reference/ and system/ directories

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Remove thiago-finch entry from AGENT-INDEX.yaml
- Remove DOSSIER-THIAGO-FINCH + TF001 refs from _INDEX.md
- Sanitize AUDIT-REPORT.json (remove username paths + personal entries)
- Remove stale settings.json.bak.pre-migration
- Update CLAUDE.md

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…ates

Layer enforcement:
- Untrack .claude/commands/AIOS/ (80 agent defs → L3 only)
- Untrack .claude/commands/{bilhon-docs,doc-master,mmos-squad,
  mmosMapper,synapse,Ralph,save,resume,sessions} → L3 only
- Untrack .claude/rules/aios-native-knowledge.md → L3 only
- Add all above to .gitignore

Config templates (for all repos):
- Add .mcp.example.json (MCP server template)
- Add .claude/settings.example.json (hooks template)
- .env.example already tracked

Files remain on disk (L3 local), removed from git tracking only.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
… refs

- Untrack .claude/settings.json (template exists as settings.example.json)
- Genericize CLAUDE-LITE.md "SOBRE THIAGO" → "SOBRE O USUÁRIO"
- Sanitize local machine paths in .planning/ and docs/audit/
- Remove personal handle refs from .planning/.continue-here.md

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…rinting

Entrega 1 — Reorganização Semântica de core/intelligence/
- Move 27 arquivos flat para 7 subdirs semânticos: pipeline/, entities/,
  validation/, retrieval/, dossier/, roles/, agents/
- Fix sys.path em 15 arquivos: .parent → .parent.parent
- Fix entity_normalizer hub (12 dependentes): bare import → absolute path
- Fix autonomous_processor cross-import (pipeline/ → pipeline/)
- Atualiza core/intelligence/__init__.py com novos paths
- Atualiza bin/validate-package.js: intelligence → intelligence/validation
- Atualiza .claude/skills/pipeline-heal/SKILL.md (4 refs)

Entrega 2 — Voice Fingerprinting System (core/intelligence/speakers/)
- voice_diarizer.py: pyannote.audio local + AssemblyAI cloud fallback
- voice_embedder.py: extrai embeddings, cosine similarity (threshold 0.85)
- voice_registry.py: CRUD VOICE-REGISTRY.yaml (gitignored como L3 Personal)
- speaker_labeler.py: CLI interativo — mostra frases, pergunta nome
- speaker_gate.py: QG-SPEAKER-001 — detecta labels em texto, 3 opções
- __init__.py: exports públicos do subsistema

Entrega 3 — Speaker Gate (phase_0: PRE_VALIDATION)
- core/tasks/validate-speakers.md: task bloqueante com 3 opções ao usuário
- core/workflows/wf-ingest.yaml: phase_0 PRE_VALIDATION antes de phase_1

Infraestrutura
- requirements.txt: pyannote.audio, torch, torchaudio, assemblyai
- .gitignore: VOICE-REGISTRY.yaml (L3 Personal — dados biométricos)
- docs/plans/: PRD brownfield EPIC-VOICE-001

Acceptance: 14/14 ✅ — python3 -c "from core.intelligence import TaskOrchestrator"
           14/14 ✅ — python3 -c "from core.intelligence.speakers import speaker_gate"

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Complete removal of all files added/modified by aios-core installation
(5 commits at 15:44 on 2026-03-03). Reverts project to pre-installation
state while preserving all prior work.

Removed:
- .claude/skills/ — 16 installation skill directories/files
- .claude/rules/ — 4 AIOS-specific rules (agent-commands, architecture, mcp-usage, semantic-routing)
- .claude/commands/ — 8 tracked AIOS commands
- system/ — entire directory (jarvis-voice, protocols, glossary, docs, database)
- reference/ — entire directory (templates, prds, protocols)
- API-KEYS-GUIDE.md, bin/supabase-setup.sql

Reverted:
- .claude/CLAUDE.md — pre-installation version
- .claude/hooks/pending_tracker.py — pre-installation version
- .claude/hooks/post_tool_use.py — pre-installation version
- .claude/hooks/skill_router.py — pre-installation version
- .claude/settings.json — restored from pre-migration backup

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…e-full

- Add TSK-050 phase5-foundation.md: per-source DNA consolidation + SOURCE log
- Add TSK-051 phase5-person-agents.md: AGENT.md/SOUL.md/MEMORY.md creation
- Add TSK-052 phase5-cargo-agents.md: cargo DNA enrichment
- Add TSK-053 phase5-theme-dossiers.md: version-aware dossier update (REGRA #21)
- Add TSK-054 phase5-org-live.md: cross-source org sync (manual trigger)
- Add TSK-055 phase5-final.md: consolidated report + validate_phase5.py (REGRA #23)
- Update wf-pipeline-full.yaml: replace generic phase_5 with 5 sequential sub-phases
- Update wf-ingest.yaml: add session_log as automatic output (skill /save)
- Update TASK-REGISTRY.md: register TSK-050..055 as PHASE 5 TASKS

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Fixes ghost directory 06-LOGS/ creation. Both hooks were writing
to PROJECT_ROOT/logs/ instead of PROJECT_ROOT/.claude/logs/.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Plan approved, full codebase audit complete (27 hooks, 40+ scripts mapped).
Ready to execute: core/paths.py + contract + enforcement hook + docs/ migration.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
voice_diarizer.py:
- diarize_assemblyai() now passes speakers_expected to API (was ignored)
- Added language_code param (default pt)
- Logs detected speaker count + hint used
- diarize() propagates both params to cloud fallback

speaker_labeler.py:
- Show stats (turns, duration %) before labeling
- Verification step: warns if detected count != expected
- Longer phrase samples (220 chars vs 120)
- Prompts user to retry with explicit num_speakers if count looks wrong

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- core/paths.py: Single Source of Truth for all output paths (equiv. aios-core config.js)
- .claude/rules/directory-contract.md: human-readable contract with routing table
- .claude/hooks/directory_contract_guard.py: PreToolUse WARN hook for prohibited dirs
- artifacts/audit/.gitkeep: new home for audit outputs

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Core files created: paths.py, contract rule, enforcement hook.
Next: migrate docs/, update scripts, register hook.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Context exhausted. Tasks 1-3 complete (paths.py, contract, hook).
Next session: start with Task 4 (migrate docs/).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
21 tracked files in docs/ mapped. Ready to execute migration.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Add explicit deny patterns for Pedro-related content across all
whitelisted directories (dossiers/persons, sources, agents, inbox).
Prevents accidental tracking of internal collaborator data.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Add .commands-bak/, .agent/, squads/ to .gitignore BLOCO 3
- Copy framework dirs from aios-stage (.aios-core, .aios, .claude/agents,
  .agents, .agent, .codex, .gemini, .commands-bak, squads)
- Clean traces: registry-update-log.jsonl, antigravity.json, epic-state.json,
  settings.local.json
- Remove nested .gitignore files (6 found and deleted)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Create 3-bucket architecture: knowledge/external/, workspace/, personal/
- Move existing content (dna, dossiers, playbooks, sources) into knowledge/external/
- Scaffold workspace/ with org, team, finance, meetings, tools, inbox
- Scaffold personal/ with email, messages, calls, cognitive, inbox
- Update core/paths.py with KNOWLEDGE_EXTERNAL, WORKSPACE, PERSONAL + 34 ROUTING keys
- Update 19 Python scripts to use new knowledge/external/ paths
- Update 14 DNA-CONFIG.yaml agent configs
- Update 24+ agent AGENT.md navigation maps
- Update 2 JS files (installer.js, pro-detector.js)
- Update CLAUDE.md architecture tree, package.json file paths
- Add Conclave/Debate 3D mode (5 modes: expert-only, business, full-3d, personal, company-only)
- Create pipeline architecture decision doc (single pipeline with conditional branches)
- Create workspace + personal log templates
- Create security layer test + agent isolation docs
- Update directory-contract.md to v2.0.0 with tridimensional layout
- Zero stale knowledge/ references remaining in codebase
- Originals preserved in .claude/trash/knowledge-root-migration-20260305/

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Workspace template: ASCII header with {COMPANY_SHORT_NAME} branding (red marker)
  - Reads company name from READ_AI_COMPANY_NAME env var
  - Smart abbreviation rules (first name, short name, or acronym)
- Personal template: ASCII "SEU CEREBRO" header (green marker)
  - Confidential document marker, L3 exclusive warning
- Templates in core/templates/logs/ (L1 tracked mechanism)
- Add workspace_log_template and personal_log_template to paths.py ROUTING

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
thiagofinch and others added 5 commits March 5, 2026 13:27
- Fix 55 stale references across AGENT.md, MEMORY.md, and DNA-CONFIG.yaml
- /knowledge/SOURCES/ → /knowledge/external/sources/ (28 files)
- QA verification: 10/10 tests now pass

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Native ANSI terminal colors for branded log headers:
- workspace: RED header with smart company name abbreviation
- personal: GREEN header with "SEU CÉREBRO" branding
- Supports --name override and --no-color mode

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Move AIOS, bilhon, and person-specific patterns to .git/info/exclude
(L3 local-only). Remove .claude/aios/ from ALLOW block. Add BLOCO 6
deny-overrides after allows so sync-injected commands are actually
blocked. Generalize all comments to remove identifying information.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Sort imports alphabetically (isort convention)
- Replace typing.Tuple/Dict/List/Optional with builtin tuple/dict/list/X|None
- Replace datetime.timezone with datetime.UTC
- Remove unused imports
- No behavioral changes

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@thiagofinch thiagofinch merged commit 736d845 into main Mar 6, 2026
2 of 4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant