karajan-code 1.57.0 → 1.58.1

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 (38) hide show
  1. package/README.md +19 -7
  2. package/docs/README.es.md +19 -7
  3. package/package.json +1 -1
  4. package/scripts/ai-attribution-guard.yml +77 -0
  5. package/scripts/esbuild-sea.config.mjs +83 -15
  6. package/scripts/install-guard-all-repos.sh +85 -0
  7. package/scripts/protect-all-repos.sh +88 -0
  8. package/src/bootstrap.js +8 -4
  9. package/src/cli.js +7 -0
  10. package/src/commands/init.js +30 -0
  11. package/src/config.js +19 -6
  12. package/src/domains/domain-loader.js +164 -0
  13. package/src/domains/domain-registry.js +140 -0
  14. package/src/domains/domain-synthesizer.js +129 -0
  15. package/src/mcp/shared-helpers.js +132 -4
  16. package/src/orchestrator/pipeline-context.js +3 -0
  17. package/src/orchestrator/preflight-checks.js +16 -5
  18. package/src/orchestrator/stages/domain-curator-stage.js +82 -0
  19. package/src/orchestrator/stages/triage-stage.js +4 -1
  20. package/src/orchestrator.js +18 -0
  21. package/src/prompts/architect.js +5 -1
  22. package/src/prompts/coder.js +5 -1
  23. package/src/prompts/hu-reviewer.js +5 -1
  24. package/src/prompts/planner.js +5 -1
  25. package/src/prompts/reviewer.js +5 -1
  26. package/src/roles/architect-role.js +1 -1
  27. package/src/roles/coder-role.js +2 -1
  28. package/src/roles/domain-curator-role.js +141 -0
  29. package/src/roles/hu-reviewer-role.js +1 -1
  30. package/src/roles/planner-role.js +6 -2
  31. package/src/roles/reviewer-role.js +7 -2
  32. package/src/roles/triage-role.js +10 -0
  33. package/src/skills/skill-loader.js +35 -4
  34. package/src/utils/process.js +4 -0
  35. package/src/utils/welcome.js +52 -0
  36. package/templates/domains/example-dental.md +57 -0
  37. package/templates/roles/domain-curator.md +52 -0
  38. package/templates/roles/triage.md +15 -1
@@ -0,0 +1,57 @@
1
+ ---
2
+ name: dental-clinical
3
+ description: Clinical dental workflows, treatment types, and orthodontic terminology
4
+ tags:
5
+ - dental
6
+ - clinical
7
+ - orthodontics
8
+ - treatments
9
+ version: 1.0.0
10
+ author: geniova
11
+ visibility: private
12
+ sources:
13
+ - type: manual
14
+ note: Created by Geniova dental team based on clinical protocols
15
+ ---
16
+
17
+ # Dental Clinical Domain
18
+
19
+ ## Core Concepts
20
+
21
+ Teeth are numbered using the FDI World Dental Federation notation system:
22
+ - Upper right: 11-18, Upper left: 21-28
23
+ - Lower left: 31-38, Lower right: 41-48
24
+
25
+ Orthodontic treatment types:
26
+ - **Fixed appliances**: brackets, archwires, bands
27
+ - **Removable aligners**: transparent trays (e.g., Invisalign-type)
28
+ - **Mixed**: combination of fixed and removable phases
29
+
30
+ Treatment lifecycle: Diagnosis -> Planning -> Approval -> Manufacturing -> Delivery -> Follow-up
31
+
32
+ ## Terminology
33
+
34
+ - **Malocclusion**: misalignment of teeth or incorrect relation between upper and lower dental arches
35
+ - **Bracket**: small attachment bonded to the tooth surface to hold the archwire
36
+ - **Archwire**: wire threaded through brackets that applies corrective force
37
+ - **Aligner**: removable transparent tray that gradually moves teeth
38
+ - **IPR (Interproximal Reduction)**: controlled removal of enamel between teeth to create space
39
+ - **Attachment**: tooth-colored bump bonded to tooth to help aligners grip
40
+ - **Overcorrection**: intentional over-movement to account for relapse tendency
41
+ - **Staging**: the sequence and timing of tooth movements across aligner steps
42
+
43
+ ## Business Rules
44
+
45
+ - Treatment plans must be approved by the lead clinician before manufacturing begins.
46
+ - Maximum standard treatment duration is 36 months; extensions require clinical justification.
47
+ - Each aligner step should move teeth no more than 0.25mm or 2 degrees of rotation.
48
+ - Clinical photos and scans are mandatory at: initial diagnosis, mid-treatment, and completion.
49
+ - Patient consent form must be signed before any irreversible procedure (e.g., IPR, extractions).
50
+
51
+ ## Common Edge Cases
52
+
53
+ - **Mixed dentition**: pediatric patients with both primary and permanent teeth require special staging to account for natural tooth eruption during treatment.
54
+ - **Missing teeth**: treatment plans must explicitly account for gaps, pontics, or implant spaces.
55
+ - **Previous orthodontic treatment**: relapse cases need different force protocols than first-time treatments.
56
+ - **TMJ disorders**: patients with temporomandibular joint issues may need movement limits per step.
57
+ - **Pregnancy**: treatment may need to be paused; certain procedures (radiographs) are contraindicated.
@@ -0,0 +1,52 @@
1
+ # Domain Curator Role
2
+
3
+ You are the **Domain Curator** in a multi-role AI pipeline.
4
+
5
+ Your job is to discover, select, and synthesize domain-specific knowledge that helps the entire pipeline understand the business context behind the task.
6
+
7
+ ## When activated
8
+
9
+ - When the Triage detects business-domain keywords (`domainHints` is non-empty).
10
+ - When domain knowledge files exist in `.karajan/domains/` or `~/.karajan/domains/`.
11
+
12
+ ## What you do
13
+
14
+ 1. **Discover**: Search for domain knowledge matching the task's business domain.
15
+ 2. **Propose**: If multiple domains are found, propose them to the user for selection.
16
+ 3. **Synthesize**: Filter and compact the selected domain knowledge into a context string optimized for token usage.
17
+
18
+ ## Domain knowledge format
19
+
20
+ Domain knowledge is stored in `DOMAIN.md` files with YAML frontmatter:
21
+
22
+ ```markdown
23
+ ---
24
+ name: dental-clinical
25
+ description: Clinical dental workflows and terminology
26
+ tags: [dental, clinical, orthodontics]
27
+ version: 1.0.0
28
+ ---
29
+
30
+ ## Core Concepts
31
+ ...
32
+
33
+ ## Terminology
34
+ ...
35
+
36
+ ## Business Rules
37
+ ...
38
+
39
+ ## Common Edge Cases
40
+ ...
41
+ ```
42
+
43
+ ## Output
44
+
45
+ The curator produces a `domainContext` string (markdown) that is injected into all downstream role prompts (Researcher, Architect, Planner, Coder, Reviewer).
46
+
47
+ ## Rules
48
+
49
+ - Always include all sections from selected domains, sorted by relevance.
50
+ - When the host does not support interactive input, use all found domains automatically.
51
+ - Do not generate domain knowledge from scratch — only discover and curate existing knowledge.
52
+ - If no domains are found, continue the pipeline without domain context (do not block).
@@ -12,7 +12,8 @@ Return a single valid JSON object and nothing else:
12
12
  "roles": ["planner", "researcher", "refactorer", "reviewer", "tester", "security", "impeccable"],
13
13
  "reasoning": "brief practical justification",
14
14
  "shouldDecompose": false,
15
- "subtasks": []
15
+ "subtasks": [],
16
+ "domainHints": []
16
17
  }
17
18
  ```
18
19
 
@@ -48,8 +49,21 @@ If the task involves frontend/UI work, include `"impeccable"` in `roles`. Detect
48
49
 
49
50
  The `impeccable` role audits and fixes frontend design quality (a11y, performance, theming, responsive, anti-patterns).
50
51
 
52
+ ## Domain detection
53
+ Analyze the task for **real-world business domain** indicators — concepts that go beyond technical frameworks.
54
+ Output them as `domainHints`: an array of lowercase keywords identifying the business domain(s) involved.
55
+
56
+ Examples:
57
+ - "Create a dental treatment workflow" → `["dental", "clinical", "treatment"]`
58
+ - "Fix invoice calculation" → `["billing", "finance", "invoice"]`
59
+ - "Add e-commerce cart" → `["e-commerce", "retail", "cart"]`
60
+ - "Refactor the React component" → `[]` (purely technical, no business domain)
61
+
62
+ `domainHints` are used by the Domain Curator to find relevant domain knowledge. Only include business-domain terms, not technical frameworks or tools.
63
+
51
64
  ## Rules
52
65
  - Keep `reasoning` short.
53
66
  - Recommend only roles that add clear value.
54
67
  - Do not include `coder` or `sonar` in `roles` (they are always active).
55
68
  - Subtask descriptions should be actionable and specific, not vague.
69
+ - `domainHints` must always be an array (empty `[]` if no domain detected).