kairos-chain 2.7.0 → 2.8.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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +23 -0
- data/lib/kairos_mcp/version.rb +1 -1
- data/templates/skillsets/knowledge_creator/config/knowledge_creator.yml +11 -0
- data/templates/skillsets/knowledge_creator/knowledge/creation_guide/creation_guide.md +101 -0
- data/templates/skillsets/knowledge_creator/knowledge/quality_criteria/quality_criteria.md +76 -0
- data/templates/skillsets/knowledge_creator/lib/knowledge_creator/assembly_templates.rb +184 -0
- data/templates/skillsets/knowledge_creator/lib/knowledge_creator.rb +51 -0
- data/templates/skillsets/knowledge_creator/skillset.json +24 -0
- data/templates/skillsets/knowledge_creator/tools/kc_compare.rb +138 -0
- data/templates/skillsets/knowledge_creator/tools/kc_evaluate.rb +158 -0
- data/templates/skillsets/skillset_creator/config/skillset_creator.yml +10 -0
- data/templates/skillsets/skillset_creator/knowledge/core_or_skillset_guide/core_or_skillset_guide.md +82 -0
- data/templates/skillsets/skillset_creator/knowledge/development_guide/development_guide.md +91 -0
- data/templates/skillsets/skillset_creator/lib/skillset_creator/review_templates.rb +223 -0
- data/templates/skillsets/skillset_creator/lib/skillset_creator/scaffold_generator.rb +248 -0
- data/templates/skillsets/skillset_creator/lib/skillset_creator.rb +57 -0
- data/templates/skillsets/skillset_creator/skillset.json +25 -0
- data/templates/skillsets/skillset_creator/tools/sc_design.rb +186 -0
- data/templates/skillsets/skillset_creator/tools/sc_review.rb +153 -0
- data/templates/skillsets/skillset_creator/tools/sc_scaffold.rb +133 -0
- metadata +21 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 00c55f8f91953d2e57924bdc4748c756c3dce18b64a77e8ff17ebed825f506ce
|
|
4
|
+
data.tar.gz: d4f1a418e9fbeecde4a5a8f9eecc37116b9620b625af0a2e91f09445fd60c673
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 96fc0ef27dcab7f578021254b8e0356644d958fb2da8a61eff02ba9862f02e4542bde04750173edeef0029a34d3a042d308217c17aa98182ebeed134f49a7337
|
|
7
|
+
data.tar.gz: 0dcbbf48a3c2d1fc6226101b204b1aa7a9f5b0f24e5f1172f29caffd3237195b611aad3684f79034c6528596e5aafa90d0e6750b347b9d5d2e7c419596418747
|
data/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,28 @@ All notable changes to the `kairos-chain` gem will be documented in this file.
|
|
|
4
4
|
|
|
5
5
|
This project follows [Semantic Versioning](https://semver.org/).
|
|
6
6
|
|
|
7
|
+
## [2.8.0] - 2026-03-08
|
|
8
|
+
|
|
9
|
+
### Added
|
|
10
|
+
|
|
11
|
+
- **Knowledge Creator SkillSet** (`knowledge_creator` v1.0.0): New opt-in SkillSet for evaluating and improving L1 knowledge quality through structured Persona Assembly prompts.
|
|
12
|
+
- `kc_evaluate`: Generate quality evaluation prompts (evaluate/analyze/criteria commands) with 7 evidence-based dimensions, 3-tier readiness assessment (READY/REVISE/DRAFT), and configurable personas (evaluator, guardian, pragmatic)
|
|
13
|
+
- `kc_compare`: Generate blind A/B comparison prompts for knowledge version comparison (L1 vs L1, L2 vs L1 promotion readiness)
|
|
14
|
+
- Bundled L1 knowledge: `quality_criteria` (evaluation dimensions, evidence requirements, persona definitions), `creation_guide` (Kairotic Creation Loop workflow, 6 structural patterns)
|
|
15
|
+
- SkillSet-local persona definitions (does not modify shared `persona_definitions`)
|
|
16
|
+
- L2 save instruction for evaluation history tracking
|
|
17
|
+
|
|
18
|
+
- **SkillSet Creator SkillSet** (`skillset_creator` v1.0.0): New opt-in meta-SkillSet for developing KairosChain SkillSets with the 5-phase development workflow.
|
|
19
|
+
- `sc_design`: Core-vs-SkillSet decision analysis (loads `core_or_skillset_guide` knowledge) and design phase checklist
|
|
20
|
+
- `sc_scaffold`: Generate complete SkillSet directory structures with skeleton files (preview/generate), input validation (path traversal prevention, collision check), explicit `output_path` required
|
|
21
|
+
- `sc_review`: Generate structured review prompts for multi-LLM review or Persona Assembly review of SkillSet designs and implementations
|
|
22
|
+
- Bundled L1 knowledge: `development_guide` (5-phase workflow, review escalation, multi-LLM best practices), `core_or_skillset_guide` (Core vs SkillSet decision tree)
|
|
23
|
+
- Runtime-detected integration with Knowledge Creator (no declared dependency; uses `defined?` check)
|
|
24
|
+
|
|
25
|
+
- **Design Process**: Both SkillSets designed through the 5-phase development meta-pattern with 2 rounds of multi-LLM review (Antigravity/Gemini, Claude Team/Opus 4.6, Codex/GPT-5.4). Design documents in `log/`.
|
|
26
|
+
|
|
27
|
+
---
|
|
28
|
+
|
|
7
29
|
## [2.7.0] - 2026-03-06
|
|
8
30
|
|
|
9
31
|
### Added
|
|
@@ -349,6 +371,7 @@ This project follows [Semantic Versioning](https://semver.org/).
|
|
|
349
371
|
- Skill promotion with Persona Assembly
|
|
350
372
|
- Tool guide and metadata system
|
|
351
373
|
|
|
374
|
+
[2.8.0]: https://github.com/masaomi/KairosChain_2026/compare/v2.7.0...v2.8.0
|
|
352
375
|
[2.7.0]: https://github.com/masaomi/KairosChain_2026/compare/v2.6.0...v2.7.0
|
|
353
376
|
[2.6.0]: https://github.com/masaomi/KairosChain_2026/compare/v2.5.0...v2.6.0
|
|
354
377
|
[2.5.0]: https://github.com/masaomi/KairosChain_2026/compare/v2.4.0...v2.5.0
|
data/lib/kairos_mcp/version.rb
CHANGED
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: creation_guide
|
|
3
|
+
description: >
|
|
4
|
+
Guide for creating and structuring L1 knowledge in KairosChain.
|
|
5
|
+
Includes the Kairotic Creation Loop workflow and 6 structural patterns
|
|
6
|
+
extracted from practical skill analysis. Use when creating new L1 knowledge,
|
|
7
|
+
restructuring existing knowledge, or analyzing structural patterns.
|
|
8
|
+
NOT for SkillSet architecture decisions (use core_or_skillset_guide).
|
|
9
|
+
version: "1.0"
|
|
10
|
+
layer: L1
|
|
11
|
+
tags: [meta, creation, workflow, patterns, structure, knowledge]
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
# L1 Knowledge Creation Guide
|
|
15
|
+
|
|
16
|
+
## Kairotic Creation Loop
|
|
17
|
+
|
|
18
|
+
Six phases for creating L1 knowledge. The LLM navigates these naturally in conversation; this is a reference, not a rigid procedure.
|
|
19
|
+
|
|
20
|
+
| Phase | Action | Key Question |
|
|
21
|
+
|-------|--------|-------------|
|
|
22
|
+
| **RECOGNIZE** | Identify repeating pattern across sessions | Has this come up 3+ times? |
|
|
23
|
+
| **DISTILL** | Extract the reusable core from session context | What's universal vs. session-specific? |
|
|
24
|
+
| **STRUCTURE** | Choose appropriate structural pattern (see below) | What format best serves this content? |
|
|
25
|
+
| **COMPOSE** | Write with proper frontmatter and body | Does description include What + When + NOT? |
|
|
26
|
+
| **EVALUATE** | Apply quality_criteria via kc_evaluate | READY / REVISE / DRAFT? |
|
|
27
|
+
| **ITERATE** | Fix issues and re-evaluate | Are all critical dimensions PASS? |
|
|
28
|
+
|
|
29
|
+
## 6 Structural Patterns
|
|
30
|
+
|
|
31
|
+
### 1. Quick Reference Table
|
|
32
|
+
**When**: Any knowledge that maps inputs to outputs or actions to approaches.
|
|
33
|
+
Always place at the top of the document.
|
|
34
|
+
|
|
35
|
+
```markdown
|
|
36
|
+
| Task | Approach | Notes |
|
|
37
|
+
|------|----------|-------|
|
|
38
|
+
| New MCP tool | SkillSet tool_classes | BaseTool inheritance |
|
|
39
|
+
| New layer concept | Core change | Rare; requires L0 review |
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
### 2. Deterministic Workflow
|
|
43
|
+
**When**: Multi-step ordered procedures where sequence matters.
|
|
44
|
+
|
|
45
|
+
```markdown
|
|
46
|
+
## Workflow
|
|
47
|
+
1. Check prerequisites → verify X exists
|
|
48
|
+
2. Execute action → run Y with parameters
|
|
49
|
+
3. Validate result → confirm Z matches expected
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
### 3. Critical Rules / Pitfalls
|
|
53
|
+
**When**: Domain-specific gotchas that cause repeated errors.
|
|
54
|
+
|
|
55
|
+
```markdown
|
|
56
|
+
## Critical Rules
|
|
57
|
+
- **NEVER** do X because Y (evidence: Z happened when this was violated)
|
|
58
|
+
- **ALWAYS** check A before B (reason: C depends on A being initialized)
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
### 4. Multi-Tool Selection
|
|
62
|
+
**When**: Multiple valid approaches exist for the same goal.
|
|
63
|
+
|
|
64
|
+
```markdown
|
|
65
|
+
| Tool | Best For | Limitation |
|
|
66
|
+
|------|----------|------------|
|
|
67
|
+
| Tool A | Simple cases | Doesn't handle edge case X |
|
|
68
|
+
| Tool B | Complex cases | Slower, requires config Y |
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
### 5. QA-First Verification
|
|
72
|
+
**When**: Output quality matters and errors are costly. Assume problems exist.
|
|
73
|
+
|
|
74
|
+
```markdown
|
|
75
|
+
## Verification Checklist
|
|
76
|
+
- [ ] Output matches expected format
|
|
77
|
+
- [ ] No placeholder values remain (search for TODO, FIXME)
|
|
78
|
+
- [ ] Edge cases tested: empty input, large input, special characters
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
### 6. Session Distillation (L2→L1)
|
|
82
|
+
**When**: Promoting session-specific work to reusable knowledge.
|
|
83
|
+
|
|
84
|
+
```markdown
|
|
85
|
+
## Distillation Steps
|
|
86
|
+
1. Remove all session-specific references (dates, filenames, user names)
|
|
87
|
+
2. Generalize the procedure: replace specific instances with patterns
|
|
88
|
+
3. Add frontmatter with description that answers: What + When + NOT
|
|
89
|
+
4. Evaluate with kc_evaluate
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
## Pattern Selection Guide
|
|
93
|
+
|
|
94
|
+
| Content Type | Primary Pattern | Secondary Pattern |
|
|
95
|
+
|-------------|-----------------|-------------------|
|
|
96
|
+
| Decision guide | Quick Reference Table | Critical Rules |
|
|
97
|
+
| Step-by-step procedure | Deterministic Workflow | QA-First |
|
|
98
|
+
| Tool/approach comparison | Multi-Tool Selection | Quick Reference Table |
|
|
99
|
+
| Domain-specific warnings | Critical Rules | Quick Reference Table |
|
|
100
|
+
| Reusable from session | Session Distillation | (varies by content) |
|
|
101
|
+
| Mixed reference | Quick Reference Table | Deterministic Workflow |
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: quality_criteria
|
|
3
|
+
description: >
|
|
4
|
+
Evidence-based quality evaluation criteria for KairosChain L1 knowledge.
|
|
5
|
+
Defines evaluation dimensions, PASS/FAIL standards, readiness levels
|
|
6
|
+
(READY/REVISE/DRAFT), and evaluation persona definitions.
|
|
7
|
+
Used by kc_evaluate tool. NOT for evaluating code or SkillSet architecture.
|
|
8
|
+
version: "1.0"
|
|
9
|
+
layer: L1
|
|
10
|
+
tags: [meta, quality, evaluation, criteria, personas]
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
# L1 Knowledge Quality Criteria
|
|
14
|
+
|
|
15
|
+
## Quick Reference
|
|
16
|
+
|
|
17
|
+
| Dimension | Question | PASS requires |
|
|
18
|
+
|-----------|----------|---------------|
|
|
19
|
+
| Triggering quality | Does `description` enable accurate identification? | What + When + Negative scope in description |
|
|
20
|
+
| Self-containedness | No session-specific context leaks? | No references to "this session", "today", specific dates |
|
|
21
|
+
| Progressive disclosure | Body vs references/ balance? | Core info in body; details in subdirectories |
|
|
22
|
+
| Evidence | Claims factual and verifiable? | Concrete examples, not vague assertions |
|
|
23
|
+
| Discrimination | Provides info base LLM doesn't have? | KairosChain-specific knowledge the model wouldn't know |
|
|
24
|
+
| Redundancy | Overlap with existing L1? | Minimal overlap; unique perspective or content |
|
|
25
|
+
| Safety alignment | No L0 conflicts? | No contradiction with CLAUDE.md principles |
|
|
26
|
+
|
|
27
|
+
## Readiness Levels
|
|
28
|
+
|
|
29
|
+
| Level | Criteria | Action |
|
|
30
|
+
|-------|----------|--------|
|
|
31
|
+
| **READY** | All critical dimensions PASS; no session-specific leaks; description enables accurate triggering | Promote to L1 |
|
|
32
|
+
| **REVISE** | Most dimensions PASS but 1-2 specific issues identified; fixable without redesign | Fix identified issues, re-evaluate |
|
|
33
|
+
| **DRAFT** | Multiple FAILs or fundamental issues; needs significant rework | Return to L2 for further development |
|
|
34
|
+
|
|
35
|
+
## Evidence Requirements
|
|
36
|
+
|
|
37
|
+
- PASS requires citing **specific evidence** from the knowledge content
|
|
38
|
+
- Surface-level compliance is FAIL (e.g., frontmatter exists but description is vague)
|
|
39
|
+
- Burden of proof is on the assertion: "it looks fine" is not evidence
|
|
40
|
+
- Each evaluation dimension must include a quoted passage or specific observation
|
|
41
|
+
|
|
42
|
+
## Evaluation Personas
|
|
43
|
+
|
|
44
|
+
### evaluator
|
|
45
|
+
- **Role**: Knowledge Quality Inspector
|
|
46
|
+
- **Bias**: High bar for evidence; superficial compliance is failure
|
|
47
|
+
- **Focus**: Can I cite specific evidence for each criterion?
|
|
48
|
+
- **When useful**: Primary evaluation of any L1 knowledge
|
|
49
|
+
|
|
50
|
+
### guardian
|
|
51
|
+
- **Role**: L0/L1 Boundary Guardian
|
|
52
|
+
- **Bias**: Conservative; protect layer integrity
|
|
53
|
+
- **Focus**: Does this knowledge stay within its declared layer? Could it conflict with L0 meta-rules?
|
|
54
|
+
- **When useful**: Knowledge that touches system behavior, governance, or meta-level concerns
|
|
55
|
+
|
|
56
|
+
### pragmatic
|
|
57
|
+
- **Role**: Practical Value Assessor
|
|
58
|
+
- **Bias**: Real-world utility over theoretical purity
|
|
59
|
+
- **Focus**: Will an LLM actually use this knowledge effectively in a real session?
|
|
60
|
+
- **When useful**: All evaluations; counterbalance to overly strict evaluation
|
|
61
|
+
|
|
62
|
+
## Frontmatter Design Guidelines
|
|
63
|
+
|
|
64
|
+
### description field
|
|
65
|
+
- Format: **What** this knowledge contains + **When** to use it + **Negative scope** (what it's NOT for)
|
|
66
|
+
- Good: "Decision guide for Core vs SkillSet classification. Use when starting new KairosChain feature development. NOT for non-KairosChain projects."
|
|
67
|
+
- Bad: "A guide about SkillSets"
|
|
68
|
+
|
|
69
|
+
### tags field
|
|
70
|
+
- 5-7 tags maximum
|
|
71
|
+
- Structure: domain tags + function tags + meta tags
|
|
72
|
+
- Example: `[meta, guide, architecture, decision, skillset, core]`
|
|
73
|
+
|
|
74
|
+
### version field
|
|
75
|
+
- Semver string: "1.0", "0.1", etc.
|
|
76
|
+
- Increment on substantive content changes, not formatting fixes
|
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module KnowledgeCreator
|
|
4
|
+
# Generates structured Persona Assembly prompts for knowledge evaluation.
|
|
5
|
+
# These templates guide the LLM to perform multi-perspective evaluation;
|
|
6
|
+
# the tool itself does NOT execute evaluation autonomously.
|
|
7
|
+
module AssemblyTemplates
|
|
8
|
+
module_function
|
|
9
|
+
|
|
10
|
+
EVALUATION_PERSONAS = {
|
|
11
|
+
'evaluator' => {
|
|
12
|
+
role: 'Knowledge Quality Inspector',
|
|
13
|
+
bias: 'High bar for evidence; superficial compliance is failure',
|
|
14
|
+
focus: 'Can I cite specific evidence for each criterion?'
|
|
15
|
+
},
|
|
16
|
+
'guardian' => {
|
|
17
|
+
role: 'L0/L1 Boundary Guardian',
|
|
18
|
+
bias: 'Conservative; protect layer integrity',
|
|
19
|
+
focus: 'Does this knowledge stay within its declared layer?'
|
|
20
|
+
},
|
|
21
|
+
'pragmatic' => {
|
|
22
|
+
role: 'Practical Value Assessor',
|
|
23
|
+
bias: 'Real-world utility over theoretical purity',
|
|
24
|
+
focus: 'Will an LLM actually use this knowledge effectively?'
|
|
25
|
+
}
|
|
26
|
+
}.freeze
|
|
27
|
+
|
|
28
|
+
COMPARE_PERSONAS = {
|
|
29
|
+
'kairos' => {
|
|
30
|
+
role: 'Philosophy Alignment Reviewer',
|
|
31
|
+
bias: 'Self-referential consistency',
|
|
32
|
+
focus: 'Which version better serves KairosChain principles?'
|
|
33
|
+
},
|
|
34
|
+
'pragmatic' => {
|
|
35
|
+
role: 'Practical Value Assessor',
|
|
36
|
+
bias: 'Real-world utility',
|
|
37
|
+
focus: 'Which version is more actionable?'
|
|
38
|
+
},
|
|
39
|
+
'skeptic' => {
|
|
40
|
+
role: 'Critical Analyst',
|
|
41
|
+
bias: 'Doubt first; prove value',
|
|
42
|
+
focus: 'Which version has fewer weaknesses?'
|
|
43
|
+
}
|
|
44
|
+
}.freeze
|
|
45
|
+
|
|
46
|
+
EVALUATION_DIMENSIONS = [
|
|
47
|
+
{ name: 'Triggering quality', question: 'Does `description` enable accurate identification from knowledge_list?' },
|
|
48
|
+
{ name: 'Self-containedness', question: 'No session-specific context leaks?' },
|
|
49
|
+
{ name: 'Progressive disclosure', question: 'Body vs references/ balance appropriate?' },
|
|
50
|
+
{ name: 'Evidence', question: 'Are claims factual and verifiable?' },
|
|
51
|
+
{ name: 'Discrimination', question: 'Does this provide information the base LLM does not have?' },
|
|
52
|
+
{ name: 'Redundancy', question: 'Overlap with existing L1 knowledge?' },
|
|
53
|
+
{ name: 'Safety alignment', question: 'No L0 conflicts?' }
|
|
54
|
+
].freeze
|
|
55
|
+
|
|
56
|
+
def evaluation_prompt(target_name:, target_content:, personas: nil, mode: 'oneshot')
|
|
57
|
+
persona_names = personas || %w[evaluator guardian pragmatic]
|
|
58
|
+
persona_defs = persona_names.map { |p| EVALUATION_PERSONAS[p] || { role: p, bias: 'General', focus: 'Overall quality' } }
|
|
59
|
+
|
|
60
|
+
<<~PROMPT
|
|
61
|
+
## Persona Assembly: Knowledge Quality Evaluation
|
|
62
|
+
|
|
63
|
+
### Mode: #{mode}
|
|
64
|
+
|
|
65
|
+
### Target Knowledge: #{target_name}
|
|
66
|
+
|
|
67
|
+
### Evaluation Task
|
|
68
|
+
Evaluate the following L1 knowledge from multiple perspectives.
|
|
69
|
+
For each dimension, cite specific evidence from the content.
|
|
70
|
+
PASS requires citing specific evidence. Surface-level compliance is FAIL.
|
|
71
|
+
|
|
72
|
+
### Personas
|
|
73
|
+
#{persona_names.each_with_index.map { |name, i|
|
|
74
|
+
d = persona_defs[i]
|
|
75
|
+
"- **#{name}** (#{d[:role]}): Bias: #{d[:bias]}. Focus: #{d[:focus]}"
|
|
76
|
+
}.join("\n")}
|
|
77
|
+
|
|
78
|
+
### Knowledge Content
|
|
79
|
+
```
|
|
80
|
+
#{target_content}
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
### Evaluation Dimensions
|
|
84
|
+
#{EVALUATION_DIMENSIONS.each_with_index.map { |dim, i|
|
|
85
|
+
"#{i + 1}. **#{dim[:name]}** — #{dim[:question]}"
|
|
86
|
+
}.join("\n")}
|
|
87
|
+
|
|
88
|
+
### Output Format
|
|
89
|
+
|
|
90
|
+
#### Readiness Assessment
|
|
91
|
+
**Level**: READY / REVISE / DRAFT
|
|
92
|
+
|
|
93
|
+
| Level | Meaning |
|
|
94
|
+
|-------|---------|
|
|
95
|
+
| READY | Meets L1 quality standards; safe to promote |
|
|
96
|
+
| REVISE | Has potential but specific issues need fixing |
|
|
97
|
+
| DRAFT | Not yet stable enough for L1 |
|
|
98
|
+
|
|
99
|
+
#### Per-Persona Evaluation
|
|
100
|
+
For each persona, for each dimension:
|
|
101
|
+
- **{Dimension}**: PASS/FAIL — Evidence: "quoted text or specific observation"
|
|
102
|
+
|
|
103
|
+
#### Summary Table
|
|
104
|
+
| Criterion | Pass Count | Fail Count |
|
|
105
|
+
|-----------|-----------|-----------|
|
|
106
|
+
|
|
107
|
+
#### Improvement Suggestions
|
|
108
|
+
Numbered list of specific, actionable improvements.
|
|
109
|
+
PROMPT
|
|
110
|
+
end
|
|
111
|
+
|
|
112
|
+
def analysis_prompt(target_name:, target_content:, creation_guide_content: nil)
|
|
113
|
+
<<~PROMPT
|
|
114
|
+
## Structural Pattern Analysis: #{target_name}
|
|
115
|
+
|
|
116
|
+
### Task
|
|
117
|
+
Analyze the structural patterns used in this knowledge and suggest improvements
|
|
118
|
+
based on the KairosChain creation guide patterns.
|
|
119
|
+
|
|
120
|
+
### Knowledge Content
|
|
121
|
+
```
|
|
122
|
+
#{target_content}
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
#{creation_guide_content ? "### Reference: Creation Guide Patterns\n```\n#{creation_guide_content}\n```" : ''}
|
|
126
|
+
|
|
127
|
+
### Analysis Dimensions
|
|
128
|
+
1. Which structural pattern(s) does this knowledge use? (Quick Reference Table, Deterministic Workflow, Critical Rules, Multi-Tool Selection, QA-First, Session Distillation)
|
|
129
|
+
2. Is the chosen pattern appropriate for the content type?
|
|
130
|
+
3. What structural improvements would increase utility?
|
|
131
|
+
4. Is the frontmatter (description, tags) well-designed?
|
|
132
|
+
|
|
133
|
+
### Output Format
|
|
134
|
+
- **Current patterns**: List detected patterns
|
|
135
|
+
- **Pattern fit**: GOOD / IMPROVABLE / MISMATCH
|
|
136
|
+
- **Suggestions**: Specific structural changes with examples
|
|
137
|
+
PROMPT
|
|
138
|
+
end
|
|
139
|
+
|
|
140
|
+
def comparison_prompt(version_a_content:, version_b_content:, blind: true, personas: nil)
|
|
141
|
+
persona_names = personas || %w[kairos pragmatic skeptic]
|
|
142
|
+
persona_defs = persona_names.map { |p| COMPARE_PERSONAS[p] || { role: p, bias: 'General', focus: 'Overall quality' } }
|
|
143
|
+
|
|
144
|
+
label_a = blind ? 'Version A' : 'Version A (current)'
|
|
145
|
+
label_b = blind ? 'Version B' : 'Version B (candidate)'
|
|
146
|
+
|
|
147
|
+
<<~PROMPT
|
|
148
|
+
## Persona Assembly: Knowledge Version Comparison
|
|
149
|
+
|
|
150
|
+
### Task
|
|
151
|
+
Compare two versions of knowledge. #{blind ? 'Labels are anonymized.' : ''}
|
|
152
|
+
Evaluate which version better serves KairosChain L1 quality standards.
|
|
153
|
+
|
|
154
|
+
### Personas
|
|
155
|
+
#{persona_names.each_with_index.map { |name, i|
|
|
156
|
+
d = persona_defs[i]
|
|
157
|
+
"- **#{name}** (#{d[:role]}): #{d[:focus]}"
|
|
158
|
+
}.join("\n")}
|
|
159
|
+
|
|
160
|
+
### #{label_a}
|
|
161
|
+
```
|
|
162
|
+
#{version_a_content}
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
### #{label_b}
|
|
166
|
+
```
|
|
167
|
+
#{version_b_content}
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
### Comparison Dimensions
|
|
171
|
+
#{EVALUATION_DIMENSIONS.map { |dim| "- **#{dim[:name]}**: #{dim[:question]}" }.join("\n")}
|
|
172
|
+
|
|
173
|
+
### Output Format
|
|
174
|
+
Per persona:
|
|
175
|
+
- **Preferred version**: A / B / Equivalent
|
|
176
|
+
- **Key differences**: 2-3 specific observations with evidence
|
|
177
|
+
- **Recommendation**: Specific action (keep A, adopt B, merge specific sections)
|
|
178
|
+
|
|
179
|
+
#### Final Recommendation
|
|
180
|
+
Majority vote with rationale.
|
|
181
|
+
PROMPT
|
|
182
|
+
end
|
|
183
|
+
end
|
|
184
|
+
end
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require_relative 'knowledge_creator/assembly_templates'
|
|
4
|
+
|
|
5
|
+
module KnowledgeCreator
|
|
6
|
+
SKILLSET_ROOT = File.expand_path('..', __dir__)
|
|
7
|
+
KNOWLEDGE_DIR = File.join(SKILLSET_ROOT, 'knowledge')
|
|
8
|
+
VERSION = '1.0.0'
|
|
9
|
+
|
|
10
|
+
class << self
|
|
11
|
+
def load!(config: {})
|
|
12
|
+
@config = config
|
|
13
|
+
@loaded = true
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def loaded?
|
|
17
|
+
@loaded == true
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
def unload!
|
|
21
|
+
@config = nil
|
|
22
|
+
@loaded = false
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
# Build a KnowledgeProvider that includes bundled knowledge.
|
|
26
|
+
# Each tool calls this to access SkillSet-local knowledge.
|
|
27
|
+
def provider(user_context: nil)
|
|
28
|
+
provider = KairosMcp::KnowledgeProvider.new(nil, user_context: user_context)
|
|
29
|
+
provider.add_external_dir(
|
|
30
|
+
KNOWLEDGE_DIR,
|
|
31
|
+
source: 'skillset:knowledge_creator',
|
|
32
|
+
layer: :L1,
|
|
33
|
+
index: true
|
|
34
|
+
)
|
|
35
|
+
provider
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
def skillset_config
|
|
39
|
+
@skillset_config ||= begin
|
|
40
|
+
config_path = File.join(SKILLSET_ROOT, 'config', 'knowledge_creator.yml')
|
|
41
|
+
if File.exist?(config_path)
|
|
42
|
+
YAML.safe_load(File.read(config_path, encoding: 'UTF-8'))&.dig('knowledge_creator') || {}
|
|
43
|
+
else
|
|
44
|
+
{}
|
|
45
|
+
end
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
load! unless loaded?
|
|
51
|
+
end
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "knowledge_creator",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "SkillSet for evaluating and improving L1 knowledge quality. Generates structured evaluation prompts using Persona Assembly, and provides blind version comparison. Use when assessing L1 knowledge quality, comparing knowledge versions, or checking promotion readiness from L2 to L1.",
|
|
5
|
+
"author": "Dr. Masa Hatakeyama",
|
|
6
|
+
"layer": "L1",
|
|
7
|
+
"depends_on": [],
|
|
8
|
+
"provides": [
|
|
9
|
+
"knowledge_quality_evaluation",
|
|
10
|
+
"knowledge_version_comparison",
|
|
11
|
+
"quality_criteria",
|
|
12
|
+
"creation_patterns"
|
|
13
|
+
],
|
|
14
|
+
"tool_classes": [
|
|
15
|
+
"KairosMcp::SkillSets::KnowledgeCreator::Tools::KcEvaluate",
|
|
16
|
+
"KairosMcp::SkillSets::KnowledgeCreator::Tools::KcCompare"
|
|
17
|
+
],
|
|
18
|
+
"config_files": ["config/knowledge_creator.yml"],
|
|
19
|
+
"knowledge_dirs": [
|
|
20
|
+
"knowledge/quality_criteria",
|
|
21
|
+
"knowledge/creation_guide"
|
|
22
|
+
],
|
|
23
|
+
"min_core_version": "2.7.0"
|
|
24
|
+
}
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module KairosMcp
|
|
4
|
+
module SkillSets
|
|
5
|
+
module KnowledgeCreator
|
|
6
|
+
module Tools
|
|
7
|
+
class KcCompare < KairosMcp::Tools::BaseTool
|
|
8
|
+
def name
|
|
9
|
+
'kc_compare'
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
def description
|
|
13
|
+
'Generate a Persona Assembly prompt for blind A/B comparison of two knowledge versions. ' \
|
|
14
|
+
'Use for L2→L1 promotion readiness, L1 revision comparison, or duplicate merge decisions. ' \
|
|
15
|
+
'This tool generates comparison prompts — it does NOT execute comparison autonomously.'
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
def input_schema
|
|
19
|
+
{
|
|
20
|
+
type: 'object',
|
|
21
|
+
properties: {
|
|
22
|
+
command: {
|
|
23
|
+
type: 'string',
|
|
24
|
+
enum: %w[compare],
|
|
25
|
+
description: 'compare: generate blind comparison prompt'
|
|
26
|
+
},
|
|
27
|
+
version_a_name: { type: 'string', description: 'Name of version A knowledge' },
|
|
28
|
+
version_a_layer: { type: 'string', enum: %w[L1 L2], description: 'Layer of version A' },
|
|
29
|
+
version_a_session_id: { type: 'string', description: 'Session ID (required if version_a_layer is L2)' },
|
|
30
|
+
version_b_name: { type: 'string', description: 'Name of version B knowledge' },
|
|
31
|
+
version_b_layer: { type: 'string', enum: %w[L1 L2], description: 'Layer of version B' },
|
|
32
|
+
version_b_session_id: { type: 'string', description: 'Session ID (required if version_b_layer is L2)' },
|
|
33
|
+
blind: {
|
|
34
|
+
type: 'boolean',
|
|
35
|
+
description: 'Anonymize as Version A / Version B (default: true)'
|
|
36
|
+
},
|
|
37
|
+
personas: {
|
|
38
|
+
type: 'array',
|
|
39
|
+
items: { type: 'string' },
|
|
40
|
+
description: 'Persona names (default: kairos, pragmatic, skeptic)'
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
required: %w[command version_a_name version_a_layer version_b_name version_b_layer]
|
|
44
|
+
}
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
def category
|
|
48
|
+
:meta
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
def usecase_tags
|
|
52
|
+
%w[knowledge comparison version promotion meta]
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
def related_tools
|
|
56
|
+
%w[kc_evaluate knowledge_get context_save]
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
def call(arguments)
|
|
60
|
+
return text_content(JSON.pretty_generate({ error: 'Only compare command is supported' })) unless arguments['command'] == 'compare'
|
|
61
|
+
|
|
62
|
+
version_a = load_version(
|
|
63
|
+
arguments['version_a_name'],
|
|
64
|
+
arguments['version_a_layer'],
|
|
65
|
+
arguments['version_a_session_id']
|
|
66
|
+
)
|
|
67
|
+
return text_content("Version A '#{arguments['version_a_name']}' not found in #{arguments['version_a_layer']}.") unless version_a
|
|
68
|
+
|
|
69
|
+
version_b = load_version(
|
|
70
|
+
arguments['version_b_name'],
|
|
71
|
+
arguments['version_b_layer'],
|
|
72
|
+
arguments['version_b_session_id']
|
|
73
|
+
)
|
|
74
|
+
return text_content("Version B '#{arguments['version_b_name']}' not found in #{arguments['version_b_layer']}.") unless version_b
|
|
75
|
+
|
|
76
|
+
blind = arguments.fetch('blind', true)
|
|
77
|
+
personas = arguments['personas']
|
|
78
|
+
|
|
79
|
+
prompt = ::KnowledgeCreator::AssemblyTemplates.comparison_prompt(
|
|
80
|
+
version_a_content: version_a[:content],
|
|
81
|
+
version_b_content: version_b[:content],
|
|
82
|
+
blind: blind,
|
|
83
|
+
personas: personas
|
|
84
|
+
)
|
|
85
|
+
|
|
86
|
+
text_content(prompt)
|
|
87
|
+
rescue StandardError => e
|
|
88
|
+
text_content(JSON.pretty_generate({ error: e.message, backtrace: e.backtrace&.first(3) }))
|
|
89
|
+
end
|
|
90
|
+
|
|
91
|
+
private
|
|
92
|
+
|
|
93
|
+
def load_version(name, layer, session_id = nil)
|
|
94
|
+
case layer
|
|
95
|
+
when 'L1'
|
|
96
|
+
load_l1(name)
|
|
97
|
+
when 'L2'
|
|
98
|
+
load_l2(name, session_id)
|
|
99
|
+
end
|
|
100
|
+
end
|
|
101
|
+
|
|
102
|
+
def load_l1(name)
|
|
103
|
+
provider = ::KnowledgeCreator.provider(user_context: @safety&.current_user)
|
|
104
|
+
skill = provider.get(name)
|
|
105
|
+
return nil unless skill
|
|
106
|
+
|
|
107
|
+
content = if skill.respond_to?(:md_file_path) && File.exist?(skill.md_file_path)
|
|
108
|
+
File.read(skill.md_file_path, encoding: 'UTF-8')
|
|
109
|
+
elsif skill.respond_to?(:content)
|
|
110
|
+
skill.content
|
|
111
|
+
else
|
|
112
|
+
skill.to_s
|
|
113
|
+
end
|
|
114
|
+
|
|
115
|
+
{ name: name, layer: 'L1', content: content }
|
|
116
|
+
end
|
|
117
|
+
|
|
118
|
+
def load_l2(name, session_id)
|
|
119
|
+
return nil unless defined?(KairosMcp::ContextManager)
|
|
120
|
+
|
|
121
|
+
cm = KairosMcp::ContextManager.new(nil, user_context: @safety&.current_user)
|
|
122
|
+
ctx = if session_id
|
|
123
|
+
cm.load_context(session_id: session_id, name: name)
|
|
124
|
+
else
|
|
125
|
+
cm.find_context(name: name)
|
|
126
|
+
end
|
|
127
|
+
return nil unless ctx
|
|
128
|
+
|
|
129
|
+
content = ctx.respond_to?(:content) ? ctx.content : ctx.to_s
|
|
130
|
+
{ name: name, layer: 'L2', content: content }
|
|
131
|
+
rescue StandardError
|
|
132
|
+
nil
|
|
133
|
+
end
|
|
134
|
+
end
|
|
135
|
+
end
|
|
136
|
+
end
|
|
137
|
+
end
|
|
138
|
+
end
|