oh-my-opencode-lite 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (111) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +365 -0
  3. package/dist/agents/deep.d.ts +2 -0
  4. package/dist/agents/designer.d.ts +2 -0
  5. package/dist/agents/explorer.d.ts +2 -0
  6. package/dist/agents/index.d.ts +8 -0
  7. package/dist/agents/librarian.d.ts +2 -0
  8. package/dist/agents/oracle.d.ts +2 -0
  9. package/dist/agents/orchestrator.d.ts +15 -0
  10. package/dist/agents/prompt-utils.d.ts +10 -0
  11. package/dist/agents/quick.d.ts +2 -0
  12. package/dist/background/background-manager.d.ts +196 -0
  13. package/dist/background/index.d.ts +2 -0
  14. package/dist/background/tmux-session-manager.d.ts +63 -0
  15. package/dist/cli/config-io.d.ts +22 -0
  16. package/dist/cli/config-manager.d.ts +4 -0
  17. package/dist/cli/custom-skills.d.ts +48 -0
  18. package/dist/cli/index.d.ts +2 -0
  19. package/dist/cli/index.js +1178 -0
  20. package/dist/cli/install.d.ts +3 -0
  21. package/dist/cli/model-key-normalization.d.ts +1 -0
  22. package/dist/cli/paths.d.ts +21 -0
  23. package/dist/cli/providers.d.ts +120 -0
  24. package/dist/cli/skill-manifest.d.ts +32 -0
  25. package/dist/cli/skills.d.ts +26 -0
  26. package/dist/cli/system.d.ts +6 -0
  27. package/dist/cli/types.d.ts +38 -0
  28. package/dist/config/constants.d.ts +19 -0
  29. package/dist/config/index.d.ts +5 -0
  30. package/dist/config/loader.d.ts +33 -0
  31. package/dist/config/schema.d.ts +313 -0
  32. package/dist/config/utils.d.ts +10 -0
  33. package/dist/delegation/delegation-manager.d.ts +25 -0
  34. package/dist/delegation/index.d.ts +4 -0
  35. package/dist/delegation/paths.d.ts +15 -0
  36. package/dist/delegation/project-id.d.ts +1 -0
  37. package/dist/delegation/types.d.ts +39 -0
  38. package/dist/hooks/auto-update-checker/cache.d.ts +6 -0
  39. package/dist/hooks/auto-update-checker/checker.d.ts +28 -0
  40. package/dist/hooks/auto-update-checker/constants.d.ts +11 -0
  41. package/dist/hooks/auto-update-checker/index.d.ts +17 -0
  42. package/dist/hooks/auto-update-checker/types.d.ts +23 -0
  43. package/dist/hooks/chat-headers.d.ts +16 -0
  44. package/dist/hooks/clarification-gate/index.d.ts +30 -0
  45. package/dist/hooks/delegate-task-retry/guidance.d.ts +2 -0
  46. package/dist/hooks/delegate-task-retry/hook.d.ts +8 -0
  47. package/dist/hooks/delegate-task-retry/index.d.ts +4 -0
  48. package/dist/hooks/delegate-task-retry/patterns.d.ts +11 -0
  49. package/dist/hooks/foreground-fallback/index.d.ts +72 -0
  50. package/dist/hooks/index.d.ts +11 -0
  51. package/dist/hooks/json-error-recovery/hook.d.ts +18 -0
  52. package/dist/hooks/json-error-recovery/index.d.ts +1 -0
  53. package/dist/hooks/phase-reminder/index.d.ts +26 -0
  54. package/dist/hooks/post-read-nudge/index.d.ts +18 -0
  55. package/dist/hooks/skill-sync.d.ts +10 -0
  56. package/dist/hooks/thoth-mem/index.d.ts +46 -0
  57. package/dist/hooks/thoth-mem/protocol.d.ts +6 -0
  58. package/dist/index.d.ts +5 -0
  59. package/dist/index.js +36210 -0
  60. package/dist/mcp/context7.d.ts +6 -0
  61. package/dist/mcp/grep-app.d.ts +6 -0
  62. package/dist/mcp/index.d.ts +7 -0
  63. package/dist/mcp/thoth.d.ts +3 -0
  64. package/dist/mcp/types.d.ts +12 -0
  65. package/dist/mcp/websearch.d.ts +6 -0
  66. package/dist/thoth/client.d.ts +14 -0
  67. package/dist/thoth/index.d.ts +2 -0
  68. package/dist/tools/ast-grep/cli.d.ts +15 -0
  69. package/dist/tools/ast-grep/constants.d.ts +25 -0
  70. package/dist/tools/ast-grep/downloader.d.ts +5 -0
  71. package/dist/tools/ast-grep/index.d.ts +10 -0
  72. package/dist/tools/ast-grep/tools.d.ts +3 -0
  73. package/dist/tools/ast-grep/types.d.ts +30 -0
  74. package/dist/tools/ast-grep/utils.d.ts +4 -0
  75. package/dist/tools/background.d.ts +13 -0
  76. package/dist/tools/index.d.ts +3 -0
  77. package/dist/tools/lsp/client.d.ts +42 -0
  78. package/dist/tools/lsp/config-store.d.ts +29 -0
  79. package/dist/tools/lsp/config.d.ts +4 -0
  80. package/dist/tools/lsp/constants.d.ts +24 -0
  81. package/dist/tools/lsp/index.d.ts +4 -0
  82. package/dist/tools/lsp/tools.d.ts +5 -0
  83. package/dist/tools/lsp/types.d.ts +35 -0
  84. package/dist/tools/lsp/utils.d.ts +34 -0
  85. package/dist/utils/agent-variant.d.ts +47 -0
  86. package/dist/utils/env.d.ts +1 -0
  87. package/dist/utils/index.d.ts +7 -0
  88. package/dist/utils/internal-initiator.d.ts +6 -0
  89. package/dist/utils/logger.d.ts +1 -0
  90. package/dist/utils/polling.d.ts +21 -0
  91. package/dist/utils/tmux.d.ts +32 -0
  92. package/dist/utils/zip-extractor.d.ts +1 -0
  93. package/oh-my-opencode-lite.schema.json +556 -0
  94. package/package.json +74 -0
  95. package/src/skills/_shared/openspec-convention.md +92 -0
  96. package/src/skills/_shared/persistence-contract.md +78 -0
  97. package/src/skills/_shared/thoth-mem-convention.md +80 -0
  98. package/src/skills/brainstorming/SKILL.md +120 -0
  99. package/src/skills/cartography/README.md +57 -0
  100. package/src/skills/cartography/SKILL.md +160 -0
  101. package/src/skills/cartography/scripts/cartographer.py +460 -0
  102. package/src/skills/cartography/scripts/test_cartographer.py +87 -0
  103. package/src/skills/executing-plans/SKILL.md +211 -0
  104. package/src/skills/plan-reviewer/SKILL.md +100 -0
  105. package/src/skills/sdd-apply/SKILL.md +101 -0
  106. package/src/skills/sdd-archive/SKILL.md +94 -0
  107. package/src/skills/sdd-design/SKILL.md +104 -0
  108. package/src/skills/sdd-propose/SKILL.md +99 -0
  109. package/src/skills/sdd-spec/SKILL.md +105 -0
  110. package/src/skills/sdd-tasks/SKILL.md +116 -0
  111. package/src/skills/sdd-verify/SKILL.md +102 -0
@@ -0,0 +1,92 @@
1
+ # OpenSpec Convention
2
+
3
+ ## Mode Scope
4
+
5
+ This convention applies only when the artifact store mode includes OpenSpec:
6
+ `openspec` and `hybrid`.
7
+
8
+ - In `thoth-mem` mode, skip canonical `openspec/` file writes.
9
+ - In `thoth-mem` mode, skip filesystem artifact recovery.
10
+
11
+ ## Directory Structure
12
+
13
+ ```text
14
+ openspec/
15
+ ├── config.yaml
16
+ ├── specs/
17
+ │ └── {domain}/spec.md
18
+ └── changes/
19
+ ├── archive/
20
+ └── {change-name}/
21
+ ├── proposal.md
22
+ ├── specs/
23
+ │ └── {domain}/spec.md
24
+ ├── design.md
25
+ ├── tasks.md
26
+ └── verify-report.md
27
+ ```
28
+
29
+ ## Canonical Artifacts
30
+
31
+ | Artifact | Canonical path | Notes |
32
+ | --- | --- | --- |
33
+ | Proposal | `openspec/changes/{change-name}/proposal.md` | Intent, scope, approach |
34
+ | Delta specs | `openspec/changes/{change-name}/specs/{domain}/spec.md` | Use one file per domain |
35
+ | Main specs | `openspec/specs/{domain}/spec.md` | Source of truth after archive |
36
+ | Design | `openspec/changes/{change-name}/design.md` | Architecture and file plan |
37
+ | Tasks | `openspec/changes/{change-name}/tasks.md` | Checkbox checklist updated by apply |
38
+ | Verify report | `openspec/changes/{change-name}/verify-report.md` | Compliance matrix and evidence |
39
+
40
+ `apply-progress` and `archive-report` are durable SDD artifacts, but they are
41
+ primarily persisted through thoth-mem topic keys when the mode includes
42
+ thoth-mem.
43
+
44
+ ## Writing Rules
45
+
46
+ - Preserve canonical filenames and locations.
47
+ - Read an existing artifact before rewriting it.
48
+ - Keep change-specific artifacts under
49
+ `openspec/changes/{change-name}/...`.
50
+ - Keep long-lived specs under `openspec/specs/{domain}/spec.md`.
51
+ - Archive completed changes under
52
+ `openspec/changes/archive/YYYY-MM-DD-{change-name}/`.
53
+
54
+ ## Artifact Content Rules
55
+
56
+ - `proposal.md` explains why the change exists.
57
+ - `spec.md` uses RFC 2119 keywords and Given/When/Then scenarios.
58
+ - `design.md` explains how the change will be implemented.
59
+ - `tasks.md` is phase-based and uses Markdown checkboxes.
60
+ - `verify-report.md` maps spec scenarios to executed evidence.
61
+
62
+ ## `config.yaml` Shape
63
+
64
+ ```yaml
65
+ schema: spec-driven
66
+
67
+ context: |
68
+ Project background, stack, and constraints.
69
+
70
+ rules:
71
+ proposal:
72
+ - Proposal-specific guidance
73
+ specs:
74
+ - Require RFC 2119 keywords
75
+ - Require Given/When/Then scenarios
76
+ design:
77
+ - Document architecture decisions with rationale
78
+ tasks:
79
+ - Use phased checklists with hierarchical numbering
80
+ apply:
81
+ - Match repository conventions
82
+ tdd: false
83
+ test_command: ''
84
+ verify:
85
+ test_command: ''
86
+ build_command: ''
87
+ coverage_threshold: 0
88
+ archive:
89
+ - Warn before destructive merges
90
+ ```
91
+
92
+ Treat `rules` entries as mandatory phase-specific constraints whenever present.
@@ -0,0 +1,78 @@
1
+ # Persistence Contract
2
+
3
+ ## Supported Persistence Modes
4
+
5
+ | Mode | Read order | Write targets | Use when |
6
+ | --- | --- | --- | --- |
7
+ | `thoth-mem` | thoth-mem only | thoth-mem only | The user wants no repo artifact changes |
8
+ | `openspec` | filesystem only | OpenSpec files only | The user wants visible repo artifacts without memory overhead |
9
+ | `hybrid` | thoth-mem, then filesystem fallback | thoth-mem and OpenSpec files | The change should survive compaction and exist in the repo |
10
+
11
+ SDD skills MUST obey the selected artifact store mode. Do not reference or rely
12
+ on engram.
13
+
14
+ ## Mode Rules
15
+
16
+ ### `thoth-mem`
17
+
18
+ 1. Read SDD artifacts from thoth-mem only.
19
+ 2. Write SDD artifacts to thoth-mem only.
20
+ 3. Do not create or modify canonical `openspec/` artifacts.
21
+
22
+ ### `openspec`
23
+
24
+ 1. Read SDD artifacts from canonical OpenSpec paths only.
25
+ 2. Write SDD artifacts to canonical OpenSpec paths only.
26
+ 3. Do not call thoth-mem save or recovery tools.
27
+
28
+ ## Hybrid Rules
29
+
30
+ When running in `hybrid` mode:
31
+
32
+ 1. Write the canonical OpenSpec artifact to the filesystem.
33
+ 2. Persist the same full artifact to thoth-mem with a deterministic `topic_key`.
34
+ 3. Treat the operation as complete only when both writes succeed.
35
+ 4. If filesystem and memory diverge, repair them immediately by rewriting the
36
+ stale copy from the freshest full artifact.
37
+
38
+ ## Retrieval Protocol
39
+
40
+ Always recover SDD dependencies in this order:
41
+
42
+ 1. If the mode is `thoth-mem`, use `thoth_mem_mem_search` with the exact SDD
43
+ topic key, then `thoth_mem_mem_get_observation` using the returned
44
+ observation ID.
45
+ 2. If the mode is `openspec`, read the canonical OpenSpec path from the
46
+ filesystem only.
47
+ 3. If the mode is `hybrid`, use `thoth_mem_mem_search` with the exact SDD topic
48
+ key, then `thoth_mem_mem_get_observation` using the returned observation ID.
49
+ 4. In `hybrid`, if nothing is found in thoth-mem, read the canonical OpenSpec
50
+ path from the filesystem.
51
+ 5. In `hybrid`, if filesystem recovery succeeds, re-save the artifact to
52
+ thoth-mem so the two stores converge again.
53
+
54
+ Never treat the preview returned by `thoth_mem_mem_search` as full source
55
+ material.
56
+
57
+ ## Artifact Ownership
58
+
59
+ - `sdd-propose` persists `sdd/{change-name}/proposal`
60
+ - `sdd-spec` persists `sdd/{change-name}/spec`
61
+ - `sdd-design` persists `sdd/{change-name}/design`
62
+ - `sdd-tasks` persists `sdd/{change-name}/tasks`
63
+ - `sdd-apply` persists `sdd/{change-name}/apply-progress` and re-persists
64
+ updated `sdd/{change-name}/tasks`
65
+ - `sdd-verify` persists `sdd/{change-name}/verify-report`
66
+ - `sdd-archive` persists `sdd/{change-name}/archive-report`
67
+
68
+ ## Recovery Notes
69
+
70
+ - Prefer exact topic-key queries over fuzzy natural-language search.
71
+ - If multiple observations match, choose the exact topic-key match for the
72
+ current project.
73
+ - In `openspec` mode, repair missing or stale artifacts by rewriting the
74
+ canonical OpenSpec file only.
75
+ - In `thoth-mem` mode, repair missing or stale artifacts by re-saving the full
76
+ artifact to thoth-mem only.
77
+ - In `hybrid` mode, use the filesystem copy only as fallback or repair input,
78
+ then converge both stores.
@@ -0,0 +1,80 @@
1
+ # thoth-mem Convention
2
+
3
+ ## Mode Scope
4
+
5
+ This convention applies only when the artifact store mode includes thoth-mem:
6
+ `thoth-mem` and `hybrid`.
7
+
8
+ - In `openspec` mode, skip thoth-mem saves.
9
+ - In `openspec` mode, skip thoth-mem recovery and use filesystem artifacts
10
+ instead.
11
+
12
+ ## Tool Names
13
+
14
+ Use the thoth-mem tool names exactly as exposed by the plugin:
15
+
16
+ - `thoth_mem_mem_search`
17
+ - `thoth_mem_mem_get_observation`
18
+ - `thoth_mem_mem_save`
19
+ - `thoth_mem_mem_update` (optional when you already have an observation ID)
20
+
21
+ ## Topic Key Format
22
+
23
+ All SDD artifacts use this deterministic pattern:
24
+
25
+ ```text
26
+ sdd/{change-name}/{artifact}
27
+ ```
28
+
29
+ Supported artifact names:
30
+
31
+ - `proposal`
32
+ - `spec`
33
+ - `design`
34
+ - `design-brief`
35
+ - `tasks`
36
+ - `apply-progress`
37
+ - `verify-report`
38
+ - `archive-report`
39
+
40
+ Use the same value for `title` and `topic_key` unless there is a strong reason
41
+ not to.
42
+
43
+ ## Two-Step Recovery
44
+
45
+ 1. Search by exact topic key:
46
+
47
+ ```text
48
+ thoth_mem_mem_search(
49
+ query: "sdd/{change-name}/{artifact}",
50
+ project: "{project}"
51
+ )
52
+ ```
53
+
54
+ 2. Retrieve the full artifact:
55
+
56
+ ```text
57
+ thoth_mem_mem_get_observation(id: {observation-id})
58
+ ```
59
+
60
+ `thoth_mem_mem_search` returns previews only. Full SDD dependencies require the
61
+ second call.
62
+
63
+ ## Save Contract
64
+
65
+ Persist SDD artifacts with a stable topic key so repeated saves upsert instead
66
+ of creating duplicates:
67
+
68
+ ```text
69
+ thoth_mem_mem_save(
70
+ title: "sdd/{change-name}/{artifact}",
71
+ topic_key: "sdd/{change-name}/{artifact}",
72
+ type: "architecture",
73
+ project: "{project}",
74
+ scope: "project",
75
+ content: "{full artifact markdown}"
76
+ )
77
+ ```
78
+
79
+ For `sdd-apply`, save the progress report under `apply-progress` and re-save the
80
+ updated task list under `tasks` after checkboxes change.
@@ -0,0 +1,120 @@
1
+ ---
2
+ name: brainstorming
3
+ description: Clarify ambiguous work, assess scope, and choose the right planning path before implementation.
4
+ metadata:
5
+ author: oh-my-opencode-lite
6
+ version: '1.0'
7
+ ---
8
+
9
+ # Brainstorming Skill
10
+
11
+ Use this skill to understand what should be built before implementation starts.
12
+ The goal is clarity, scope calibration, and a user-approved handoff.
13
+
14
+ ## Shared Conventions
15
+
16
+ - `~/.config/opencode/skills/_shared/thoth-mem-convention.md`
17
+ - `~/.config/opencode/skills/_shared/persistence-contract.md`
18
+
19
+ ## HARD GATE
20
+
21
+ - Do not implement during brainstorming.
22
+ - Do not write code.
23
+ - Do not patch files.
24
+ - Do not create formal SDD artifacts until the user approves the route.
25
+
26
+ ## Workflow
27
+
28
+ ### Phase 1: Context Gathering
29
+
30
+ 1. Dispatch `@explorer` and `@librarian` in parallel for codebase and external
31
+ context.
32
+ 2. Collect only the minimum context needed to improve questions and reduce user
33
+ repetition.
34
+ 3. Prefer facts from the codebase and known references over asking the user for
35
+ information the environment can answer.
36
+
37
+ ### Phase 2: Interview
38
+
39
+ 1. Ask 1 question at a time.
40
+ 2. Ask at most 5 total questions.
41
+ 3. Prefer multiple-choice questions when practical.
42
+ 4. Stop early when clarity is already sufficient.
43
+ 5. Do not ask for details that the codebase, task artifacts, or gathered
44
+ context already answer.
45
+
46
+ ### Phase 3: Scope Assessment
47
+
48
+ Evaluate these 7 scope signals:
49
+
50
+ 1. Multiple views, pages, or user flows
51
+ 2. New or modified API endpoints, queries, or data models
52
+ 3. Restructuring existing functionality
53
+ 4. Affects multiple layers such as frontend and backend, or UI and logic and
54
+ data
55
+ 5. Described in business or UX terms instead of specific code changes
56
+ 6. Scope is ambiguous or open-ended
57
+ 7. Would likely touch 3 or more files across different directories
58
+
59
+ Signal mapping:
60
+
61
+ - `0-1` = trivial
62
+ - `2-4` = medium
63
+ - `5+` = complex
64
+
65
+ ### Phase 4: Approach Proposal
66
+
67
+ 1. Present 2-3 viable options.
68
+ 2. For each option, give the main trade-offs.
69
+ 3. Mark one option as the recommendation.
70
+ 4. Ask the user to confirm the preferred approach before moving on.
71
+
72
+ ### Phase 5: User Approval
73
+
74
+ Present:
75
+
76
+ - Summary of understanding
77
+ - Scope classification and why
78
+ - Recommended approach
79
+ - Proposed handoff path
80
+
81
+ Then wait for explicit user approval.
82
+
83
+ The user is the sole approver during brainstorming. Do not request oracle
84
+ review here.
85
+
86
+ ### Phase 6: Handoff
87
+
88
+ Recommend a route based on complexity, then wait for the user to confirm it:
89
+
90
+ - Trivial (`1-2` files): direct implementation
91
+ - Medium (`3-7` files): accelerated SDD (`propose -> tasks`)
92
+ - Complex (`8+` files): full SDD (`propose -> spec -> design -> tasks`)
93
+
94
+ Before any SDD generation starts, present the artifact store policy choice:
95
+
96
+ ```text
97
+ How would you like to persist planning artifacts?
98
+ 1. thoth-mem — Memory only. Lightest token cost. No repo files.
99
+ 2. openspec — Repo files only. Visible and reviewable.
100
+ 3. hybrid — Both. Maximum durability, higher token cost.
101
+ Default: hybrid
102
+ ```
103
+
104
+ Do not silently choose the handoff route or artifact store mode. Recommend, ask,
105
+ and wait.
106
+
107
+ ## Guardrails
108
+
109
+ - Maximum 5 interview questions.
110
+ - Ask only one question at a time.
111
+ - Do not ask what codebase context can answer.
112
+ - Do not skip explicit user approval.
113
+ - Do not auto-select the handoff route.
114
+
115
+ ## Anti-Patterns
116
+
117
+ - Question dumping
118
+ - Option inflation
119
+ - Premature implementation
120
+ - Silent route selection
@@ -0,0 +1,57 @@
1
+ # Cartography Skill
2
+
3
+ Repository understanding and hierarchical codemap generation.
4
+
5
+ ## Overview
6
+
7
+ Cartography helps orchestrators map and understand codebases by:
8
+
9
+ 1. Selecting relevant code/config files using LLM judgment
10
+ 2. Creating `.lite/cartography.json` for change tracking
11
+ 3. Generating empty `codemap.md` templates for explorers to fill in
12
+
13
+ ## Commands
14
+
15
+ ```bash
16
+ # Initialize mapping
17
+ python3 cartographer.py init --root /repo --include "src/**/*.ts" --exclude "node_modules/**"
18
+
19
+ # Check what changed
20
+ python3 cartographer.py changes --root /repo
21
+
22
+ # Update hashes
23
+ python3 cartographer.py update --root /repo
24
+ ```
25
+
26
+ ## Outputs
27
+
28
+ ### .lite/cartography.json
29
+
30
+ ```json
31
+ {
32
+ "metadata": {
33
+ "version": "1.0.0",
34
+ "last_run": "2026-01-25T19:00:00Z",
35
+ "include_patterns": ["src/**/*.ts"],
36
+ "exclude_patterns": ["node_modules/**"]
37
+ },
38
+ "file_hashes": {
39
+ "src/index.ts": "abc123..."
40
+ },
41
+ "folder_hashes": {
42
+ "src": "def456..."
43
+ }
44
+ }
45
+ ```
46
+
47
+ ### codemap.md (per folder)
48
+
49
+ Empty templates created in each folder for explorers to fill with:
50
+ - Responsibility
51
+ - Design patterns
52
+ - Data/control flow
53
+ - Integration points
54
+
55
+ ## Installation
56
+
57
+ Installed automatically via oh-my-opencode-lite installer when custom skills are enabled.
@@ -0,0 +1,160 @@
1
+ ---
2
+ name: cartography
3
+ description: Repository understanding and hierarchical codemap generation
4
+ ---
5
+
6
+ # Cartography Skill
7
+
8
+ You help users understand and map repositories by creating hierarchical codemaps.
9
+
10
+ ## When to Use
11
+
12
+ - User asks to understand/map a repository
13
+ - User wants codebase documentation
14
+ - Starting work on an unfamiliar codebase
15
+
16
+ ## Workflow
17
+
18
+ ### Step 1: Check for Existing State
19
+
20
+ **First, check if `.lite/cartography.json` exists in the repo root.**
21
+
22
+ If it **exists**: Skip to Step 3 (Detect Changes) - no need to re-initialize.
23
+
24
+ If it **doesn't exist**: Continue to Step 2 (Initialize).
25
+
26
+ ### Step 2: Initialize (Only if no state exists)
27
+
28
+ 1. **Analyze the repository structure** - List files, understand directories
29
+ 2. **Infer patterns** for **core code/config files ONLY** to include:
30
+ - **Include**: `src/**/*.ts`, `package.json`, etc.
31
+ - **Exclude (MANDATORY)**: Do NOT include tests, documentation, or translations.
32
+ - Tests: `**/*.test.ts`, `**/*.spec.ts`, `tests/**`, `__tests__/**`
33
+ - Docs: `docs/**`, `*.md` (except root `README.md` if needed), `LICENSE`
34
+ - Build/Deps: `node_modules/**`, `dist/**`, `build/**`, `*.min.js`
35
+ - Respect `.gitignore` automatically
36
+ 3. **Run cartographer.py init**:
37
+
38
+ ```bash
39
+ python3 ~/.config/opencode/skills/cartography/scripts/cartographer.py init \
40
+ --root ./ \
41
+ --include "src/**/*.ts" \
42
+ --exclude "**/*.test.ts" --exclude "dist/**" --exclude "node_modules/**"
43
+ ```
44
+
45
+ This creates:
46
+ - `.lite/cartography.json` - File and folder hashes for change detection
47
+ - Empty `codemap.md` files in all relevant subdirectories
48
+
49
+ 4. **Delegate to Explorer agents** - Spawn one explorer per folder to read code and fill in its specific `codemap.md` file.
50
+
51
+ ### Step 3: Detect Changes (If state already exists)
52
+
53
+ 1. **Run cartographer.py changes** to see what changed:
54
+
55
+ ```bash
56
+ python3 ~/.config/opencode/skills/cartography/scripts/cartographer.py changes \
57
+ --root ./
58
+ ```
59
+
60
+ 2. **Review the output** - It shows:
61
+ - Added files
62
+ - Removed files
63
+ - Modified files
64
+ - Affected folders
65
+
66
+ 3. **Only update affected codemaps** - Spawn one explorer per affected folder to update its `codemap.md`.
67
+ 4. **Run update** to save new state:
68
+
69
+ ```bash
70
+ python3 ~/.config/opencode/skills/cartography/scripts/cartographer.py update \
71
+ --root ./
72
+ ```
73
+
74
+ ### Step 4: Finalize Repository Atlas (Root Codemap)
75
+
76
+ Once all specific directories are mapped, the Orchestrator must create or update the root `codemap.md`. This file serves as the **Master Entry Point** for any agent or human entering the repository.
77
+
78
+ 1. **Map Root Assets**: Document the root-level files (e.g., `package.json`, `index.ts`, `plugin.json`) and the project's overall purpose.
79
+ 2. **Aggregate Sub-Maps**: Create a "Repository Directory Map" section. For every folder that has a `codemap.md`, extract its **Responsibility** summary and include it in a table or list in the root map.
80
+ 3. **Cross-Reference**: Ensure that the root map contains the absolute or relative paths to the sub-maps so agents can jump directly to the relevant details.
81
+
82
+ ### Step 5: Register Codemap in AGENTS.md
83
+
84
+ **OpenCode auto-loads `AGENTS.md` into agent context on every session.** To ensure agents automatically discover and use the codemap, update (or create) `AGENTS.md` at the repo root:
85
+
86
+ 1. If `AGENTS.md` already exists and already contains a `## Repository Map` section, **skip this step** — the reference is already set up.
87
+ 2. If `AGENTS.md` exists but has no `## Repository Map` section, **append** the section below.
88
+ 3. If `AGENTS.md` doesn't exist, **create** it with the section below.
89
+
90
+ ```markdown
91
+ ## Repository Map
92
+
93
+ A full codemap is available at `codemap.md` in the project root.
94
+
95
+ Before working on any task, read `codemap.md` to understand:
96
+ - Project architecture and entry points
97
+ - Directory responsibilities and design patterns
98
+ - Data flow and integration points between modules
99
+
100
+ For deep work on a specific folder, also read that folder's `codemap.md`.
101
+ ```
102
+
103
+ This is idempotent — repeated cartography runs will detect the existing section and skip. No duplication.
104
+
105
+
106
+ ## Codemap Content
107
+
108
+ Explorers are granted write permissions for `codemap.md` files during this workflow. Use precise technical terminology to document the implementation:
109
+
110
+ - **Responsibility** - Define the specific role of this directory using standard software engineering terms (e.g., "Service Layer", "Data Access Object", "Middleware").
111
+ - **Design Patterns** - Identify and name specific patterns used (e.g., "Observer", "Singleton", "Factory", "Strategy"). Detail the abstractions and interfaces.
112
+ - **Data & Control Flow** - Explicitly trace how data enters and leaves the module. Mention specific function call sequences and state transitions.
113
+ - **Integration Points** - List dependencies and consumer modules. Use technical names for hooks, events, or API endpoints.
114
+
115
+ Example codemap:
116
+
117
+ ```markdown
118
+ # src/agents/
119
+
120
+ ## Responsibility
121
+ Defines agent personalities and manages their configuration lifecycle.
122
+
123
+ ## Design
124
+ Each agent is a prompt + permission set. Config system uses:
125
+ - Default prompts (orchestrator.ts, explorer.ts, etc.)
126
+ - User overrides from ~/.config/opencode/oh-my-opencode-lite.json
127
+ - Permission wildcards for skill/MCP access control
128
+
129
+ ## Flow
130
+ 1. Plugin loads → calls getAgentConfigs()
131
+ 2. Reads user config preset
132
+ 3. Merges defaults with overrides
133
+ 4. Applies permission rules (wildcard expansion)
134
+ 5. Returns agent configs to OpenCode
135
+
136
+ ## Integration
137
+ - Consumed by: Main plugin (src/index.ts)
138
+ - Depends on: Config loader, skills registry
139
+ ```
140
+
141
+ Example **Root Codemap (Atlas)**:
142
+
143
+ ```markdown
144
+ # Repository Atlas: oh-my-opencode-lite
145
+
146
+ ## Project Responsibility
147
+ A high-performance, low-latency agent orchestration plugin for OpenCode, focusing on specialized sub-agent delegation and background task management.
148
+
149
+ ## System Entry Points
150
+ - `src/index.ts`: Plugin initialization and OpenCode integration.
151
+ - `package.json`: Dependency manifest and build scripts.
152
+ - `oh-my-opencode-lite.json`: User configuration schema.
153
+
154
+ ## Directory Map (Aggregated)
155
+ | Directory | Responsibility Summary | Detailed Map |
156
+ |-----------|------------------------|--------------|
157
+ | `src/agents/` | Defines agent personalities (Orchestrator, Explorer) and manages model routing. | [View Map](src/agents/codemap.md) |
158
+ | `src/features/` | Core logic for tmux integration, background task spawning, and session state. | [View Map](src/features/codemap.md) |
159
+ | `src/config/` | Implements the configuration loading pipeline and environment variable injection. | [View Map](src/config/codemap.md) |
160
+ ```