|
1 | 1 | #!/bin/bash |
2 | | -# MiOS Omni-Agent Bootstrap Script |
3 | | -# Synchronizes manifests and initializes sub-project environments. |
| 2 | +# MiOS AI/manifest bootstrap. Regenerates directory manifests, syncs the Wiki, |
| 3 | +# rebuilds the unified knowledge base (RAG snapshot), refreshes user-space |
| 4 | +# environment configs, and seeds shared agent context. Idempotent. |
4 | 5 |
|
5 | 6 | set -euo pipefail |
6 | 7 |
|
7 | | -echo "🚀 Initializing MiOS Agent Workspace..." |
| 8 | +echo "[ai-bootstrap] Initializing MiOS agent workspace..." |
8 | 9 |
|
9 | | -# 0. Load Unified Environment |
| 10 | +# 0. Load unified environment (legacy .env.mios; deprecated — prefer |
| 11 | +# /etc/mios/profile.toml for new installs). |
10 | 12 | if [[ -f ".env.mios" ]]; then |
11 | | - echo "📜 Loading unified environment from .env.mios..." |
12 | | - # Export all variables defined in .env.mios |
| 13 | + echo "[ai-bootstrap] Loading legacy environment from .env.mios..." |
13 | 14 | set -a |
| 15 | + # shellcheck disable=SC1091 |
14 | 16 | source .env.mios |
15 | 17 | set +a |
16 | 18 | fi |
17 | 19 |
|
18 | | -# 1. Generate Manifests |
| 20 | +# 1. Generate manifests. |
19 | 21 | if [[ -f "tools/generate-ai-manifest.py" ]]; then |
20 | | - echo "📄 Generating directory manifests..." |
| 22 | + echo "[ai-bootstrap] Generating directory manifests..." |
21 | 23 | python3 tools/generate-ai-manifest.py |
22 | 24 | else |
23 | | - echo "⚠️ Warning: tools/generate-ai-manifest.py not found." |
| 25 | + echo "[ai-bootstrap] WARN: tools/generate-ai-manifest.py not found" |
24 | 26 | fi |
25 | 27 |
|
26 | | -# 2. Sync Wiki Documentation |
| 28 | +# 2. Sync Wiki documentation. |
27 | 29 | if [[ -f "tools/sync-wiki.py" ]]; then |
28 | | - echo "📖 Syncing Wiki..." |
| 30 | + echo "[ai-bootstrap] Syncing Wiki..." |
29 | 31 | python3 tools/sync-wiki.py |
30 | 32 | else |
31 | | - echo "⚠️ Warning: tools/sync-wiki.py not found." |
| 33 | + echo "[ai-bootstrap] WARN: tools/sync-wiki.py not found" |
32 | 34 | fi |
33 | 35 |
|
34 | | -# 3. Generate Unified Knowledge Base (RAG Snapshot) |
| 36 | +# 3. Generate unified knowledge base (RAG snapshot). |
35 | 37 | if [[ -f "tools/generate-unified-knowledge.py" ]]; then |
36 | | - echo "🧠 Generating Unified Knowledge Base (RAG Snapshot)..." |
37 | | - if [[ -f "tools/journal-sync.py" ]]; then |
38 | | - python3 tools/journal-sync.py |
39 | | - fi |
| 38 | + echo "[ai-bootstrap] Generating unified knowledge base (RAG snapshot)..." |
| 39 | + [[ -f "tools/journal-sync.py" ]] && python3 tools/journal-sync.py |
40 | 40 | python3 tools/generate-unified-knowledge.py |
41 | 41 | else |
42 | | - echo "⚠️ Warning: tools/generate-unified-knowledge.py not found." |
| 42 | + echo "[ai-bootstrap] WARN: tools/generate-unified-knowledge.py not found" |
43 | 43 | fi |
44 | 44 |
|
45 | | -# 4. Initialize agents/research |
| 45 | +# 4. Initialize agents/research scratchpad if present. |
46 | 46 | if [[ -d "agents/research" ]]; then |
47 | | - echo "🧪 Initializing agents/research (Agent Starter Pack)..." |
48 | | - # Placeholder for future agent initialization logic |
49 | | - # (cd agents/research && make install) |
| 47 | + echo "[ai-bootstrap] Initializing agents/research scratchpad..." |
50 | 48 | else |
51 | | - echo "⚠️ Warning: agents/research directory not found." |
| 49 | + echo "[ai-bootstrap] WARN: agents/research directory not found" |
52 | 50 | fi |
53 | 51 |
|
54 | | -# 3. Persistence: Refresh environment configs and dotfiles |
55 | | -echo "💾 Persisting environment state..." |
| 52 | +# 5. Refresh environment configs and dotfiles. |
| 53 | +echo "[ai-bootstrap] Persisting environment state..." |
56 | 54 | if [[ -f "tools/refresh-env.py" ]]; then |
57 | 55 | python3 tools/refresh-env.py |
58 | 56 | else |
59 | | - echo "⚠️ Warning: tools/refresh-env.py not found." |
| 57 | + echo "[ai-bootstrap] WARN: tools/refresh-env.py not found" |
60 | 58 | fi |
61 | 59 |
|
62 | | -echo "✅ Workspace initialization complete." |
| 60 | +echo "[ai-bootstrap] Workspace initialization complete." |
63 | 61 |
|
64 | | -# 6. Seed Artifacts for Agents |
65 | | -echo "🌱 Seeding latest MiOS Artifacts for initialized agents..." |
| 62 | +# 6. Seed RAG context for downstream agents. |
| 63 | +echo "[ai-bootstrap] Seeding latest MiOS context for initialized agents..." |
66 | 64 | if [[ -f "artifacts/repo-rag-snapshot.json.gz" ]]; then |
67 | | - # Shared scratchpad for cross-agent IPC |
68 | 65 | mkdir -p .ai/foundation/shared-tmp/ |
69 | 66 | cp artifacts/repo-rag-snapshot.json.gz .ai/foundation/shared-tmp/latest-context.json.gz |
70 | | - # Sub-project local context |
71 | 67 | cp artifacts/repo-rag-snapshot.json.gz agents/research/latest-context.json.gz |
72 | | - echo "✅ Context seeded to .ai/foundation/shared-tmp/ and agents/research/" |
| 68 | + echo "[ai-bootstrap] Context seeded to .ai/foundation/shared-tmp/ and agents/research/" |
73 | 69 | else |
74 | | - echo "⚠️ Warning: artifacts/repo-rag-snapshot.json.gz not found. Skip seeding." |
| 70 | + echo "[ai-bootstrap] WARN: artifacts/repo-rag-snapshot.json.gz not found; skipping seed" |
75 | 71 | fi |
0 commit comments