@dzhechkov/keysarium 1.1.2 → 1.3.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 (62) hide show
  1. package/README.md +7 -2
  2. package/package.json +10 -2
  3. package/templates/.claude/commands/brain-export.md +97 -20
  4. package/templates/.claude/commands/brain-import.md +75 -4
  5. package/templates/.claude/commands/dream.md +101 -0
  6. package/templates/.claude/commands/feature-adr.md +92 -0
  7. package/templates/.claude/commands/init-platform.md +161 -0
  8. package/templates/.claude/commands/learning-stats.md +130 -0
  9. package/templates/.claude/commands/workers.md +140 -0
  10. package/templates/.claude/rules/background-workers.md +72 -0
  11. package/templates/.claude/rules/dream-cycles.md +90 -0
  12. package/templates/.claude/rules/feature-adr-conventions.md +82 -0
  13. package/templates/.claude/rules/reward-learning.md +124 -0
  14. package/templates/.claude/shards/feature-adr.shard.md +98 -0
  15. package/templates/.claude/skills/feature-adr/SKILL.md +252 -0
  16. package/templates/.claude/skills/feature-adr/examples/sample-feature-output.md +257 -0
  17. package/templates/.claude/skills/feature-adr/modules/00-complexity-router.md +114 -0
  18. package/templates/.claude/skills/feature-adr/modules/01-requirements.md +113 -0
  19. package/templates/.claude/skills/feature-adr/modules/02-research.md +92 -0
  20. package/templates/.claude/skills/feature-adr/modules/03-adr.md +135 -0
  21. package/templates/.claude/skills/feature-adr/modules/04-ddd.md +114 -0
  22. package/templates/.claude/skills/feature-adr/modules/05-architecture.md +149 -0
  23. package/templates/.claude/skills/feature-adr/modules/06-implementation-plan.md +129 -0
  24. package/templates/.claude/skills/feature-adr/modules/07-code.md +126 -0
  25. package/templates/.claude/skills/feature-adr/modules/08-qe.md +167 -0
  26. package/templates/.claude/skills/feature-adr/references/adr-template.md +102 -0
  27. package/templates/.claude/skills/feature-adr/references/c4-template.md +120 -0
  28. package/templates/.claude/skills/feature-adr/references/complexity-matrix.md +139 -0
  29. package/templates/.claude/skills/feature-adr/references/qe-checklist.md +86 -0
  30. package/templates/CLAUDE.md +135 -8
  31. package/templates/docs/feature-adr/01-architecture.md +750 -0
  32. package/templates/docs/feature-adr/02-functionality.md +712 -0
  33. package/templates/docs/feature-adr/03-deployment-guide.md +614 -0
  34. package/templates/docs/feature-adr/04-admin-guide.md +564 -0
  35. package/templates/docs/feature-adr/05-user-guide.md +508 -0
  36. package/templates/docs/feature-adr/06-user-flows.md +1101 -0
  37. package/templates/docs/improvement-directions.md +16 -16
  38. package/templates/docs/keysarium/01-deployment-guide.md +21 -12
  39. package/templates/docs/keysarium/02-admin-guide.md +204 -3
  40. package/templates/docs/keysarium/03-user-guide.md +224 -0
  41. package/templates/docs/keysarium/05-architecture.md +181 -0
  42. package/templates/docs/keysarium/06-user-flows.md +235 -0
  43. package/templates/docs/keysarium-core/01-architecture.md +559 -0
  44. package/templates/docs/keysarium-core/02-functionality.md +953 -0
  45. package/templates/docs/keysarium-core/03-deployment-guide.md +625 -0
  46. package/templates/docs/keysarium-core/04-admin-guide.md +529 -0
  47. package/templates/docs/keysarium-core/05-user-guide.md +599 -0
  48. package/templates/docs/keysarium-core/06-user-flows.md +804 -0
  49. package/templates/lib/background-workers.md +278 -0
  50. package/templates/lib/dream-engine.md +460 -0
  51. package/templates/lib/judge-attestation.md +322 -0
  52. package/templates/lib/memory-protocol.md +344 -0
  53. package/templates/lib/platform-adapters.md +100 -0
  54. package/templates/lib/platform-templates/copilot.md +134 -0
  55. package/templates/lib/platform-templates/cursor.md +95 -0
  56. package/templates/lib/platform-templates/opencode.md +155 -0
  57. package/templates/lib/reward-tracker.md +256 -0
  58. package/templates/lib/witness-chain.md +372 -0
  59. package/templates/lib/worker-templates/brain-export.md +187 -0
  60. package/templates/lib/worker-templates/consolidate.md +180 -0
  61. package/templates/lib/worker-templates/dream-cycle.md +154 -0
  62. package/templates/lib/worker-templates/health-check.md +255 -0
@@ -0,0 +1,100 @@
1
+ # Platform Adapter Definitions
2
+
3
+ Central registry for multi-platform support. Maps each supported AI coding platform to its configuration format, output paths, and translation strategy.
4
+
5
+ ## Supported Platforms
6
+
7
+ | Platform | Template | Config Format | Output Structure |
8
+ |----------|----------|---------------|------------------|
9
+ | Cursor | `lib/platform-templates/cursor.md` | Single `.cursorrules` file + optional `.cursor/skills/` | Flat rules file with inlined skills |
10
+ | OpenCode | `lib/platform-templates/opencode.md` | `.opencode/` directory with `config.yaml` + skill files | Directory hierarchy matching `.claude/` |
11
+ | GitHub Copilot | `lib/platform-templates/copilot.md` | `.github/copilot-instructions.md` single file | Single markdown file with all instructions |
12
+
13
+ ## Platform Details
14
+
15
+ ### Cursor
16
+
17
+ | Property | Value |
18
+ |----------|-------|
19
+ | Config file | `.cursorrules` (project root) |
20
+ | Format | Plain text / TOML-style rules |
21
+ | Skills directory | `.cursor/skills/` (optional, one file per skill) |
22
+ | Rules handling | All rules concatenated into `.cursorrules` under sections |
23
+ | Skill handling | Key instructions extracted from SKILL.md and inlined; large skills get separate files in `.cursor/skills/` |
24
+ | Max config size | Recommended < 10,000 tokens |
25
+ | Platform docs | Cursor uses `.cursorrules` for project-level AI instructions |
26
+
27
+ ### OpenCode
28
+
29
+ | Property | Value |
30
+ |----------|-------|
31
+ | Config directory | `.opencode/` (project root) |
32
+ | Config file | `.opencode/config.yaml` |
33
+ | Skills directory | `.opencode/skills/` (one `.md` file per skill) |
34
+ | Rules directory | `.opencode/rules/` (one `.md` file per rule) |
35
+ | Rules handling | Each rule file copied with format adaptation |
36
+ | Skill handling | Each skill gets its own markdown file with instructions |
37
+ | Platform docs | OpenCode uses directory-based configuration |
38
+
39
+ ### GitHub Copilot
40
+
41
+ | Property | Value |
42
+ |----------|-------|
43
+ | Config file | `.github/copilot-instructions.md` |
44
+ | Format | Single markdown file |
45
+ | Skills handling | All skills summarized into sections within the file |
46
+ | Rules handling | All rules merged into the instructions file |
47
+ | Max config size | Recommended < 8,000 tokens (Copilot context window considerations) |
48
+ | Platform docs | GitHub Copilot reads `.github/copilot-instructions.md` for custom instructions |
49
+
50
+ ## Translation Strategy
51
+
52
+ ### Source Structure (`.claude/`)
53
+
54
+ ```
55
+ .claude/
56
+ ├── skills/
57
+ │ ├── explore/SKILL.md
58
+ │ ├── goap-research-ed25519/SKILL.md
59
+ │ ├── problem-solver-enhanced/SKILL.md
60
+ │ ├── frontend-design/SKILL.md
61
+ │ ├── presentation-storyteller/SKILL.md
62
+ │ ├── reverse-engineering-unicorn/SKILL.md
63
+ │ ├── bto/SKILL.md
64
+ │ └── feature-adr/SKILL.md
65
+ ├── rules/
66
+ │ ├── agent-swarm.md
67
+ │ ├── anti-patterns.md
68
+ │ ├── checkpoint-protocol.md
69
+ │ ├── domain-specific.md
70
+ │ ├── file-conventions.md
71
+ │ ├── modular-reuse.md
72
+ │ ├── research-quality.md
73
+ │ ├── model-routing.md
74
+ │ ├── trust-tiers.md
75
+ │ ├── bto-quality-gates.md
76
+ │ ├── feature-adr-conventions.md
77
+ │ └── feedback-loops.md
78
+ └── commands/
79
+ └── *.md
80
+ ```
81
+
82
+ ### Translation Rules
83
+
84
+ 1. **Skills:** Read each `SKILL.md`, extract the core protocol/instructions section. For single-file platforms (Cursor, Copilot), summarize to key points. For directory-based platforms (OpenCode), preserve full content.
85
+
86
+ 2. **Rules:** Read each rule file. For single-file platforms, merge all rules under a unified "Rules" section with subsections. For directory-based platforms, create one file per rule.
87
+
88
+ 3. **Commands:** Commands are Claude Code-specific and generally not translatable. Include a note in generated configs pointing users to the `.claude/commands/` directory for reference.
89
+
90
+ 4. **Shards:** Governance shards (`.claude/shards/`) are pipeline-specific. Include them as supplementary context in platforms that support directory structures; omit from single-file platforms.
91
+
92
+ ## Adding a New Platform
93
+
94
+ To add support for a new platform:
95
+
96
+ 1. Create `lib/platform-templates/<platform-name>.md` following the template pattern
97
+ 2. Add an entry to the "Supported Platforms" table above
98
+ 3. Add a "Platform Details" section with config format, paths, and constraints
99
+ 4. Update `/init-platform` command's `--platform` argument to include the new name
100
+ 5. Test generation with the new platform
@@ -0,0 +1,134 @@
1
+ # GitHub Copilot Platform Template
2
+
3
+ > Generates `.github/copilot-instructions.md` from `.claude/` sources.
4
+
5
+ ## Target Format
6
+
7
+ GitHub Copilot reads custom instructions from `.github/copilot-instructions.md`. This is a single markdown file that provides project-level context and instructions to Copilot's AI assistant.
8
+
9
+ ## Generation Protocol
10
+
11
+ ### Step 1: Generate `.github/copilot-instructions.md`
12
+
13
+ Create `.github/copilot-instructions.md` with the following structure:
14
+
15
+ ```markdown
16
+ # {Project Name} — Copilot Instructions
17
+
18
+ > Auto-generated from .claude/ directory by /init-platform. Source of truth: .claude/
19
+
20
+ ## Project Overview
21
+
22
+ {Extract the project description from CLAUDE.md:
23
+ - Purpose (2-3 sentences)
24
+ - Key concepts (pipeline phases, skills, research methodology)
25
+ - Project structure overview (simplified directory tree)
26
+ }
27
+
28
+ ## Core Rules
29
+
30
+ {For each file in .claude/rules/, create a subsection:}
31
+
32
+ ### {Rule Name}
33
+
34
+ {Summarize the rule to 5-10 key bullet points.
35
+ Focus on actionable instructions.
36
+ Omit implementation details specific to Claude Code.
37
+ Preserve critical constraints (PARANOID mode, mandatory phases, etc.)
38
+ }
39
+
40
+ ---
41
+
42
+ ## Skills Reference
43
+
44
+ {For each skill in .claude/skills/:}
45
+
46
+ ### {Skill Name}
47
+
48
+ **Purpose:** {One-line description}
49
+
50
+ **When to use:** {Extract the "When" or trigger conditions}
51
+
52
+ **Key protocol:**
53
+ {Numbered list of 3-5 core steps from the skill's protocol section.
54
+ Simplify each step to 1-2 sentences.
55
+ Omit tool-specific references.}
56
+
57
+ **Quality gates:**
58
+ {2-4 key quality checks from the skill}
59
+
60
+ ---
61
+
62
+ ## Pipeline Overview
63
+
64
+ {Simplified version of the phase pipeline:}
65
+
66
+ | Phase | Purpose | Key Output |
67
+ |-------|---------|------------|
68
+ {One row per phase, extracted from CLAUDE.md pipeline table}
69
+
70
+ ## Anti-Patterns to Avoid
71
+
72
+ {Extract the anti-patterns table, keeping the Pattern and Required Fix columns}
73
+
74
+ ## Domain-Specific Guidance
75
+
76
+ {Summarize domain rules from .claude/rules/domain-specific.md:
77
+ - Banking: key constraints
78
+ - Retail: key constraints
79
+ - Enterprise: key constraints
80
+ Keep each domain to 3-4 bullet points.}
81
+
82
+ ## File Conventions
83
+
84
+ {Extract key file naming and directory conventions from .claude/rules/file-conventions.md}
85
+ ```
86
+
87
+ ### Step 2: Size Check
88
+
89
+ After generation, verify:
90
+ - `.github/copilot-instructions.md` is under 8,000 tokens (~6,000 words)
91
+ - If over limit, prioritize in this order:
92
+ 1. Core Rules (keep all)
93
+ 2. Anti-Patterns (keep all)
94
+ 3. Skills Reference (summarize further)
95
+ 4. Pipeline Overview (keep)
96
+ 5. Domain-Specific Guidance (trim to most relevant domain)
97
+
98
+ ### Step 3: Ensure `.github/` Directory Exists
99
+
100
+ If `.github/` directory does not exist, create it. If `copilot-instructions.md` already exists, warn the user and generate to `copilot-instructions.generated.md` instead.
101
+
102
+ ## Content Adaptation Rules
103
+
104
+ | Source Element | Copilot Adaptation |
105
+ |----------------|---------------------|
106
+ | `Read: .claude/skills/X/SKILL.md` | Summarize inline (no separate files) |
107
+ | Agent tool references | "Break complex tasks into sub-tasks" |
108
+ | Model routing (haiku/sonnet/opus) | Omit entirely (Copilot uses its own model) |
109
+ | `$ARGUMENTS` variable | "User-provided context" |
110
+ | Promise tags `<promise>` | Keep as phase completion markers |
111
+ | Checkpoint protocol | "Confirm with user before moving to next phase" |
112
+ | BTO-specific content | Omit or heavily summarize (not relevant for Copilot workflows) |
113
+ | Governance shards | Summarize key constraints only |
114
+
115
+ ## Example Output Structure
116
+
117
+ ```
118
+ .github/
119
+ └── copilot-instructions.md (single file, <8K tokens)
120
+ ```
121
+
122
+ ## Copilot-Specific Notes
123
+
124
+ 1. **Copilot reads the entire file** on each interaction, so shorter is better
125
+ 2. **No directory-based skills** — everything must be in the single markdown file
126
+ 3. **Copilot does not support slash commands** — reference commands as "workflows" or "procedures"
127
+ 4. **Focus on rules and constraints** — Copilot benefits most from clear do/don't instructions
128
+ 5. **Code patterns over prose** — where possible, show code examples instead of lengthy descriptions
129
+
130
+ ## Last Verified
131
+
132
+ Platform: GitHub Copilot
133
+ Format version: .github/copilot-instructions.md (2025+)
134
+ Last verified: 2026-03-01
@@ -0,0 +1,95 @@
1
+ # Cursor Platform Template
2
+
3
+ > Generates `.cursorrules` and optionally `.cursor/skills/` from `.claude/` sources.
4
+
5
+ ## Target Format
6
+
7
+ Cursor uses a `.cursorrules` file in the project root. This is a plain-text/markdown file that Cursor's AI reads as project-level instructions. Optionally, `.cursor/skills/` can hold longer skill documents.
8
+
9
+ ## Generation Protocol
10
+
11
+ ### Step 1: Generate `.cursorrules`
12
+
13
+ Create a file `.cursorrules` in the project root with the following structure:
14
+
15
+ ```
16
+ # Project: {project name from CLAUDE.md title}
17
+
18
+ ## Project Overview
19
+
20
+ {Extract the first 2-3 paragraphs from CLAUDE.md that describe the project purpose}
21
+
22
+ ## Rules
23
+
24
+ {For each file in .claude/rules/:}
25
+
26
+ ### {Rule file name without extension, title-cased}
27
+
28
+ {Extract the key rules as bullet points. Omit tables and complex formatting.
29
+ Keep each rule to 1-2 lines. Target: 3-8 bullet points per rule file.}
30
+
31
+ ## Skills
32
+
33
+ {For each skill in .claude/skills/:}
34
+
35
+ ### {Skill name, title-cased}
36
+
37
+ {Read SKILL.md and extract:
38
+ - One-line description (from the skill's header or first paragraph)
39
+ - Core protocol steps (numbered list, 3-5 key steps)
40
+ - Key constraints or quality gates (2-3 bullet points)
41
+ Keep each skill section to 15-30 lines maximum.}
42
+
43
+ ## Pipeline
44
+
45
+ {Extract the pipeline phases table from CLAUDE.md, simplified to:
46
+ Phase name | Description | Key output}
47
+
48
+ ## Anti-Patterns
49
+
50
+ {Copy the anti-patterns table from CLAUDE.md or .claude/rules/anti-patterns.md}
51
+ ```
52
+
53
+ ### Step 2: Generate `.cursor/skills/` (for large skills)
54
+
55
+ If any skill's SKILL.md exceeds 200 lines, create a separate file in `.cursor/skills/`:
56
+
57
+ ```
58
+ .cursor/skills/{skill-name}.md
59
+ ```
60
+
61
+ Content: the full SKILL.md content, reformatted to remove Claude Code-specific references (like "Read: .claude/skills/..." instructions). Replace with relative references.
62
+
63
+ ### Step 3: Size Check
64
+
65
+ After generation, verify:
66
+ - `.cursorrules` is under 10,000 tokens (~7,500 words)
67
+ - If over limit, further summarize skill sections (keep rules intact)
68
+
69
+ ## Content Adaptation Rules
70
+
71
+ | Source Element | Cursor Adaptation |
72
+ |----------------|-------------------|
73
+ | `Read: .claude/skills/X/SKILL.md` | Replace with: "Follow the {X} skill protocol" |
74
+ | Agent tool references | Replace with: "For parallel work, break into sub-tasks" |
75
+ | Model routing (haiku/sonnet/opus) | Omit (Cursor uses its own model) |
76
+ | `$ARGUMENTS` variable | Replace with: "User-provided input" |
77
+ | Promise tags `<promise>` | Keep as documentation markers |
78
+ | Checkpoint protocol | Adapt to: "Pause and confirm with user before proceeding" |
79
+
80
+ ## Example Output Structure
81
+
82
+ ```
83
+ .cursorrules (main instructions file, <10K tokens)
84
+ .cursor/
85
+ └── skills/
86
+ ├── reverse-engineering-unicorn.md (full skill, if >200 lines)
87
+ ├── bto.md (full skill, if >200 lines)
88
+ └── feature-adr.md (full skill, if >200 lines)
89
+ ```
90
+
91
+ ## Last Verified
92
+
93
+ Platform: Cursor
94
+ Format version: .cursorrules (2025+)
95
+ Last verified: 2026-03-01
@@ -0,0 +1,155 @@
1
+ # OpenCode Platform Template
2
+
3
+ > Generates `.opencode/` directory structure from `.claude/` sources.
4
+
5
+ ## Target Format
6
+
7
+ OpenCode uses a `.opencode/` directory in the project root with a `config.yaml` configuration file and skill/rule markdown files. This is the most structurally similar platform to Claude Code's `.claude/` directory.
8
+
9
+ ## Generation Protocol
10
+
11
+ ### Step 1: Generate `.opencode/config.yaml`
12
+
13
+ Create `.opencode/config.yaml` with the following structure:
14
+
15
+ ```yaml
16
+ # OpenCode configuration for {project name}
17
+ # Generated from .claude/ directory by /init-platform
18
+ # Source: product-keysarium-2026
19
+
20
+ project:
21
+ name: "{project name from CLAUDE.md}"
22
+ description: "{first paragraph of CLAUDE.md}"
23
+
24
+ instructions: |
25
+ {Extract the critical rules from CLAUDE.md:
26
+ - File conventions
27
+ - Research quality requirements (PARANOID mode)
28
+ - Checkpoint protocol summary
29
+ - Anti-patterns to avoid
30
+ Keep to 30-50 lines.}
31
+
32
+ skills_dir: ".opencode/skills"
33
+ rules_dir: ".opencode/rules"
34
+ ```
35
+
36
+ ### Step 2: Generate `.opencode/skills/`
37
+
38
+ For each skill in `.claude/skills/`:
39
+
40
+ Create `.opencode/skills/{skill-name}.md`:
41
+
42
+ ```markdown
43
+ # {Skill Name}
44
+
45
+ {Full content of SKILL.md with the following adaptations:}
46
+
47
+ {Replace Claude Code-specific instructions:
48
+ - "Read: .claude/skills/X/SKILL.md" → "See: .opencode/skills/X.md"
49
+ - "Read: .claude/rules/X.md" → "See: .opencode/rules/X.md"
50
+ - Agent tool references → "For parallel work, break into sub-tasks"
51
+ - Model routing references → Omit or note as "model selection is platform-managed"
52
+ }
53
+
54
+ {If the skill has references/ directory:
55
+ - Inline key reference content at the bottom under "## References"
56
+ - Or create .opencode/skills/{skill-name}/ directory with reference files
57
+ }
58
+
59
+ {If the skill has modules/ directory:
60
+ - Create .opencode/skills/{skill-name}/ directory
61
+ - Copy module files with path adaptations
62
+ }
63
+ ```
64
+
65
+ ### Step 3: Generate `.opencode/rules/`
66
+
67
+ For each rule file in `.claude/rules/`:
68
+
69
+ Create `.opencode/rules/{rule-name}.md`:
70
+
71
+ ```markdown
72
+ # {Rule Title}
73
+
74
+ {Full content of the rule file, with minimal adaptation:
75
+ - Replace .claude/ paths with .opencode/ paths
76
+ - Keep tables and structured content intact
77
+ - Remove Claude Code-specific tool references
78
+ }
79
+ ```
80
+
81
+ ### Step 4: Generate `.opencode/README.md`
82
+
83
+ Create a brief README explaining the configuration:
84
+
85
+ ```markdown
86
+ # OpenCode Configuration
87
+
88
+ This directory was generated from `.claude/` by the `/init-platform` command.
89
+
90
+ ## Structure
91
+
92
+ - `config.yaml` — Main configuration
93
+ - `skills/` — Skill definitions (one per file)
94
+ - `rules/` — Project rules (one per file)
95
+
96
+ ## Regenerating
97
+
98
+ To regenerate this configuration from updated `.claude/` sources:
99
+ ```
100
+ /init-platform --platform opencode
101
+ ```
102
+
103
+ ## Source
104
+
105
+ Generated from: .claude/ directory
106
+ Generated on: {date}
107
+ ```
108
+
109
+ ## Content Adaptation Rules
110
+
111
+ | Source Element | OpenCode Adaptation |
112
+ |----------------|---------------------|
113
+ | `.claude/skills/X/SKILL.md` | `.opencode/skills/X.md` |
114
+ | `.claude/rules/X.md` | `.opencode/rules/X.md` |
115
+ | `.claude/shards/X.md` | `.opencode/shards/X.md` (if shards are included) |
116
+ | `Read: path` instructions | `See: adapted-path` |
117
+ | Agent tool references | "Break into sub-tasks for parallel work" |
118
+ | Model routing (haiku/sonnet/opus) | Omit (platform-managed) |
119
+ | `$ARGUMENTS` variable | "User-provided input" |
120
+
121
+ ## Example Output Structure
122
+
123
+ ```
124
+ .opencode/
125
+ ├── config.yaml
126
+ ├── README.md
127
+ ├── skills/
128
+ │ ├── explore.md
129
+ │ ├── goap-research-ed25519.md
130
+ │ ├── problem-solver-enhanced.md
131
+ │ ├── frontend-design.md
132
+ │ ├── presentation-storyteller.md
133
+ │ ├── reverse-engineering-unicorn.md
134
+ │ ├── bto.md
135
+ │ └── feature-adr.md
136
+ └── rules/
137
+ ├── agent-swarm.md
138
+ ├── anti-patterns.md
139
+ ├── checkpoint-protocol.md
140
+ ├── domain-specific.md
141
+ ├── file-conventions.md
142
+ ├── modular-reuse.md
143
+ ├── research-quality.md
144
+ ├── model-routing.md
145
+ ├── trust-tiers.md
146
+ ├── bto-quality-gates.md
147
+ ├── feature-adr-conventions.md
148
+ └── feedback-loops.md
149
+ ```
150
+
151
+ ## Last Verified
152
+
153
+ Platform: OpenCode
154
+ Format version: .opencode/ directory (2025+)
155
+ Last verified: 2026-03-01