Class: KairosMcp::Tools::SkillsPromote

Inherits:
BaseTool
  • Object
show all
Defined in:
lib/kairos_mcp/tools/skills_promote.rb

Overview

SkillsPromote: Tool for promoting knowledge between layers with optional Persona Assembly

Supports:

  • L2 → L1: Promote context to knowledge (hash recorded)

  • L1 → L0: Promote knowledge to meta-skill (requires human approval, full record)

When with_assembly=true, generates a structured discussion template using personas defined in L1 knowledge (persona_definitions).

Constant Summary collapse

VALID_TRANSITIONS =
{
  'L2' => ['L1'],
  'L1' => ['L0']
}.freeze
DEFAULT_PERSONAS =
%w[kairos].freeze

Instance Method Summary collapse

Methods inherited from BaseTool

#initialize, #invoke_tool, #to_full_schema, #to_schema

Constructor Details

This class inherits a constructor from KairosMcp::Tools::BaseTool

Instance Method Details

#call(arguments) ⇒ Object



133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
# File 'lib/kairos_mcp/tools/skills_promote.rb', line 133

def call(arguments)
  command = arguments['command']

  case command
  when 'analyze'
    handle_analyze(arguments)
  when 'promote'
    handle_promote(arguments)
  when 'status'
    handle_status(arguments)
  when 'suggest'
    handle_suggest(arguments)
  else
    text_content("Unknown command: #{command}")
  end
end

#categoryObject



38
39
40
# File 'lib/kairos_mcp/tools/skills_promote.rb', line 38

def category
  :skills
end

#descriptionObject



32
33
34
35
36
# File 'lib/kairos_mcp/tools/skills_promote.rb', line 32

def description
  'Promote knowledge between layers (L2→L1, L1→L0) with optional Persona Assembly for decision support. ' \
  'Assembly generates a structured discussion from multiple perspectives before human decision. ' \
  'For pattern detection and auto-scan, use dream_scan instead.'
end

#examplesObject



46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
# File 'lib/kairos_mcp/tools/skills_promote.rb', line 46

def examples
  [
    {
      title: 'Analyze promotion with Persona Assembly',
      code: 'skills_promote(command: "analyze", source_name: "my_context", from_layer: "L2", to_layer: "L1", session_id: "session_123", personas: ["kairos", "pragmatic"])'
    },
    {
      title: 'Direct promotion L2 to L1',
      code: 'skills_promote(command: "promote", source_name: "validated_idea", from_layer: "L2", to_layer: "L1", session_id: "session_123", reason: "Validated through use")'
    },
    {
      title: 'Check promotion requirements',
      code: 'skills_promote(command: "status", from_layer: "L1", to_layer: "L0")'
    },
    {
      title: 'Suggest optimal personas for content',
      code: 'skills_promote(command: "suggest", source_name: "my_context", from_layer: "L2", to_layer: "L1", session_id: "session_123")'
    }
  ]
end

#input_schemaObject



71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
# File 'lib/kairos_mcp/tools/skills_promote.rb', line 71

def input_schema
  {
    type: 'object',
    properties: {
      command: {
        type: 'string',
        description: 'Command: "analyze" (with assembly), "promote" (direct promotion), "status" (check requirements), or "suggest" (LLM suggests optimal personas)',
        enum: %w[analyze promote status suggest]
      },
      source_name: {
        type: 'string',
        description: 'Name of the source knowledge/context to promote'
      },
      from_layer: {
        type: 'string',
        description: 'Source layer: "L2" or "L1"',
        enum: %w[L2 L1]
      },
      to_layer: {
        type: 'string',
        description: 'Target layer: "L1" or "L0"',
        enum: %w[L1 L0]
      },
      target_name: {
        type: 'string',
        description: 'Name in the target layer (defaults to source_name)'
      },
      reason: {
        type: 'string',
        description: 'Reason for promotion'
      },
      session_id: {
        type: 'string',
        description: 'Session ID (required when from_layer is L2)'
      },
      personas: {
        type: 'array',
        items: { type: 'string' },
        description: 'Personas to use for assembly (default: ["kairos"]). Pre-defined: kairos, conservative, radical, pragmatic, optimistic, skeptic. Custom persona names are also accepted — the LLM will infer the role from the name and context. Use command: "suggest" to get context-aware recommendations.'
      },
      assembly_mode: {
        type: 'string',
        description: 'Assembly mode: "oneshot" (default, single evaluation) or "discussion" (multi-round with facilitator)',
        enum: %w[oneshot discussion]
      },
      facilitator: {
        type: 'string',
        description: 'Facilitator persona for discussion mode (default: "kairos")'
      },
      max_rounds: {
        type: 'integer',
        description: 'Maximum discussion rounds for discussion mode (default: 3)'
      },
      consensus_threshold: {
        type: 'number',
        description: 'Consensus threshold for early termination in discussion mode (default: 0.6 = 60%)'
      },
    },
    required: %w[command]
  }
end

#nameObject



28
29
30
# File 'lib/kairos_mcp/tools/skills_promote.rb', line 28

def name
  'skills_promote'
end


67
68
69
# File 'lib/kairos_mcp/tools/skills_promote.rb', line 67

def related_tools
  %w[context_save knowledge_update skills_evolve skills_audit attestation_issue]
end

#usecase_tagsObject



42
43
44
# File 'lib/kairos_mcp/tools/skills_promote.rb', line 42

def usecase_tags
  %w[promote L2 L1 L0 upgrade permanent persona assembly]
end