kairos-chain 2.0.0 → 2.0.2
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 +44 -0
- data/lib/kairos_mcp/protocol.rb +39 -1
- data/lib/kairos_mcp/tool_registry.rb +3 -0
- data/lib/kairos_mcp/tools/instructions_update.rb +415 -0
- data/lib/kairos_mcp/version.rb +1 -1
- data/lib/kairos_mcp.rb +17 -10
- data/templates/knowledge/kairoschain_operations/kairoschain_operations.md +32 -10
- data/templates/knowledge/kairoschain_operations_jp/kairoschain_operations_jp.md +32 -10
- data/templates/knowledge/kairoschain_usage/kairoschain_usage.md +71 -3
- data/templates/knowledge/kairoschain_usage_jp/kairoschain_usage_jp.md +71 -3
- data/templates/skills/config.yml +6 -0
- data/templates/skills/kairos.md +30 -0
- data/templates/skills/kairos.rb +1 -0
- data/templates/skills/kairos_quickguide.md +34 -0
- metadata +7 -5
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 55d548669cc17cb03a2383d2ffc164e991fdaf20268d8600bf67d9720d16635e
|
|
4
|
+
data.tar.gz: fea72512c6c3dd2ab6265eea9b2c8f4fea81bed97556aca19fd3699c3014f565
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: cd6d5385186edfb65081e3ea97e96be3e42eb47dc27d863ea65767c532df1a39cc8adff22dc716123f7ac2574619db90e368b5bda58d961de63bdc857862c014
|
|
7
|
+
data.tar.gz: 627fb035955f7f6b9050d58c6e72635a818b4385a27e331614513d3c1e1fefe86c8025efa0e799c19e4b18a3c44b7ee5ddc3616601ea03bfc0642cf083de843f
|
data/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,48 @@ 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.0.2] - 2026-02-23
|
|
8
|
+
|
|
9
|
+
### Added
|
|
10
|
+
|
|
11
|
+
- **Dynamic `instructions_mode`**: Custom mode resolution for MCP instructions
|
|
12
|
+
- `instructions_mode: 'researcher'` now resolves to `skills/researcher.md`
|
|
13
|
+
- Any `.md` file in `skills/` can serve as an instruction source
|
|
14
|
+
- Built-in modes (`developer`, `user`, `none`) unchanged
|
|
15
|
+
- **`instructions_update` tool**: L0-level instructions management with 5 commands
|
|
16
|
+
- `status`: Show current mode and available instruction files
|
|
17
|
+
- `create`: Create new instruction file (requires human approval)
|
|
18
|
+
- `update`: Update existing instruction file (requires human approval)
|
|
19
|
+
- `delete`: Delete custom instruction file (built-in protected)
|
|
20
|
+
- `set_mode`: Switch `instructions_mode` in config.yml (requires human approval)
|
|
21
|
+
- All changes recorded to blockchain (full recording, L0_law level)
|
|
22
|
+
- Path traversal protection, reserved mode name guard, active mode deletion prevention
|
|
23
|
+
- **L1 Knowledge**: HestiaChain Meeting Place knowledge added to active knowledge directory
|
|
24
|
+
- **L1 Knowledge**: Updated operations roadmap with Phase 4A/4B completion info
|
|
25
|
+
|
|
26
|
+
### Fixed
|
|
27
|
+
|
|
28
|
+
- **Encoding**: Added `# encoding: utf-8` to `kairos.rb` DSL files (fixes multibyte char errors with arrows/emojis)
|
|
29
|
+
- **Encoding**: Added UTF-8 encoding to `build_readme.rb` file reads (fixes README generation on non-UTF-8 locales)
|
|
30
|
+
- **L1 Knowledge**: Updated tool count from 25 to 26 in usage documentation (EN + JP)
|
|
31
|
+
- **L1 Knowledge**: Restored Phase 4.pre/4A/4B progress info in operations knowledge (EN + JP)
|
|
32
|
+
|
|
33
|
+
---
|
|
34
|
+
|
|
35
|
+
## [2.0.1] - 2026-02-23
|
|
36
|
+
|
|
37
|
+
### Added
|
|
38
|
+
|
|
39
|
+
- **MCP Instructions**: `instructions` field in `initialize` response delivers
|
|
40
|
+
KairosChain philosophy or quick guide to LLM on connection
|
|
41
|
+
- `instructions_mode` config: `developer` (full kairos.md), `user` (quick guide), `none`
|
|
42
|
+
- New template: `kairos_quickguide.md` — concise user-facing operational guide
|
|
43
|
+
- **L0-A Philosophy**: Added PHILOSOPHY-001 (Generative Principle) and
|
|
44
|
+
PHILOSOPHY-005 (Five Propositions) to `kairos.md`
|
|
45
|
+
- **Agent Instruction Sync**: `scripts/sync_agent_instructions.sh` syncs CLAUDE.md
|
|
46
|
+
to `.cursor/rules/kairos.mdc` for Cursor IDE support
|
|
47
|
+
- **Test**: Initialize instructions test (Test 0) in `test_local.rb`
|
|
48
|
+
|
|
7
49
|
## [2.0.0] - 2026-02-23
|
|
8
50
|
|
|
9
51
|
### Breaking Changes
|
|
@@ -125,6 +167,8 @@ This project follows [Semantic Versioning](https://semver.org/).
|
|
|
125
167
|
- Skill promotion with Persona Assembly
|
|
126
168
|
- Tool guide and metadata system
|
|
127
169
|
|
|
170
|
+
[2.0.2]: https://github.com/masaomi/KairosChain_2026/compare/v2.0.1...v2.0.2
|
|
171
|
+
[2.0.1]: https://github.com/masaomi/KairosChain_2026/compare/v2.0.0...v2.0.1
|
|
128
172
|
[2.0.0]: https://github.com/masaomi/KairosChain_2026/compare/v1.2.0...v2.0.0
|
|
129
173
|
[1.2.0]: https://github.com/masaomi/KairosChain_2026/compare/v1.0.0...v1.2.0
|
|
130
174
|
[1.0.0]: https://github.com/masaomi/KairosChain_2026/compare/v0.9.0...v1.0.0
|
data/lib/kairos_mcp/protocol.rb
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
require 'json'
|
|
2
2
|
require_relative 'tool_registry'
|
|
3
|
+
require_relative 'skills_config'
|
|
3
4
|
require_relative 'version'
|
|
4
5
|
|
|
5
6
|
module KairosMcp
|
|
@@ -59,7 +60,7 @@ module KairosMcp
|
|
|
59
60
|
@tool_registry.set_workspace(roots)
|
|
60
61
|
@initialized = true
|
|
61
62
|
|
|
62
|
-
{
|
|
63
|
+
result = {
|
|
63
64
|
protocolVersion: protocol_version,
|
|
64
65
|
capabilities: {
|
|
65
66
|
tools: {
|
|
@@ -72,6 +73,43 @@ module KairosMcp
|
|
|
72
73
|
version: KairosMcp::VERSION
|
|
73
74
|
}
|
|
74
75
|
}
|
|
76
|
+
|
|
77
|
+
# Add instructions based on config mode (developer/user/none)
|
|
78
|
+
instructions = load_instructions
|
|
79
|
+
result[:instructions] = instructions if instructions
|
|
80
|
+
|
|
81
|
+
result
|
|
82
|
+
end
|
|
83
|
+
|
|
84
|
+
# Load instructions based on instructions_mode in config.yml
|
|
85
|
+
#
|
|
86
|
+
# @return [String, nil] Instructions text or nil
|
|
87
|
+
def load_instructions
|
|
88
|
+
mode = SkillsConfig.load['instructions_mode'] || 'user'
|
|
89
|
+
|
|
90
|
+
path = case mode
|
|
91
|
+
when 'developer'
|
|
92
|
+
KairosMcp.md_path # Full philosophy (kairos.md)
|
|
93
|
+
when 'user'
|
|
94
|
+
KairosMcp.quickguide_path # Quick guide (kairos_quickguide.md)
|
|
95
|
+
when 'none'
|
|
96
|
+
nil
|
|
97
|
+
else
|
|
98
|
+
# Dynamic custom mode: resolve to skills/{mode}.md
|
|
99
|
+
File.join(KairosMcp.skills_dir, "#{mode}.md")
|
|
100
|
+
end
|
|
101
|
+
|
|
102
|
+
return nil unless path
|
|
103
|
+
|
|
104
|
+
read_if_exists(path)
|
|
105
|
+
end
|
|
106
|
+
|
|
107
|
+
# Read file content if it exists
|
|
108
|
+
#
|
|
109
|
+
# @param path [String] File path
|
|
110
|
+
# @return [String, nil] File content or nil
|
|
111
|
+
def read_if_exists(path)
|
|
112
|
+
File.exist?(path) ? File.read(path) : nil
|
|
75
113
|
end
|
|
76
114
|
|
|
77
115
|
def handle_tools_list
|
|
@@ -36,6 +36,9 @@ module KairosMcp
|
|
|
36
36
|
|
|
37
37
|
# Audit tools (health checks, archive management, recommendations)
|
|
38
38
|
register_if_defined('KairosMcp::Tools::SkillsAudit')
|
|
39
|
+
|
|
40
|
+
# L0: Instructions management (system prompt control with full blockchain record)
|
|
41
|
+
register_if_defined('KairosMcp::Tools::InstructionsUpdate')
|
|
39
42
|
|
|
40
43
|
# Resource tools (unified access to L0/L1/L2 resources)
|
|
41
44
|
register_if_defined('KairosMcp::Tools::ResourceList')
|
|
@@ -0,0 +1,415 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'digest'
|
|
4
|
+
require 'fileutils'
|
|
5
|
+
require_relative 'base_tool'
|
|
6
|
+
require_relative '../skills_config'
|
|
7
|
+
require_relative '../action_log'
|
|
8
|
+
|
|
9
|
+
module KairosMcp
|
|
10
|
+
module Tools
|
|
11
|
+
class InstructionsUpdate < BaseTool
|
|
12
|
+
# Protected built-in files that cannot be deleted
|
|
13
|
+
PROTECTED_FILES = %w[kairos.md kairos_quickguide.md].freeze
|
|
14
|
+
# Reserved mode names that map to built-in behavior
|
|
15
|
+
RESERVED_MODES = %w[developer user none].freeze
|
|
16
|
+
|
|
17
|
+
def name
|
|
18
|
+
'instructions_update'
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def description
|
|
22
|
+
'Create, update, or delete custom instruction files and switch instructions_mode. ' \
|
|
23
|
+
'Instructions control the AI system prompt (L0-level). ' \
|
|
24
|
+
'All changes require human approval and are recorded to blockchain.'
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
def category
|
|
28
|
+
:skills
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
def usecase_tags
|
|
32
|
+
%w[instructions mode L0 system-prompt identity philosophy customize]
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
def examples
|
|
36
|
+
[
|
|
37
|
+
{
|
|
38
|
+
title: 'Check current instructions status',
|
|
39
|
+
code: 'instructions_update(command: "status")'
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
title: 'Create custom instructions',
|
|
43
|
+
code: 'instructions_update(command: "create", mode_name: "researcher", ' \
|
|
44
|
+
'content: "# Researcher Constitution\n...", ' \
|
|
45
|
+
'reason: "Create researcher identity", approved: true)'
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
title: 'Switch to custom mode',
|
|
49
|
+
code: 'instructions_update(command: "set_mode", mode_name: "researcher", ' \
|
|
50
|
+
'reason: "Activate researcher identity", approved: true)'
|
|
51
|
+
}
|
|
52
|
+
]
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
def related_tools
|
|
56
|
+
%w[skills_list skills_get chain_history]
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
def input_schema
|
|
60
|
+
{
|
|
61
|
+
type: 'object',
|
|
62
|
+
properties: {
|
|
63
|
+
command: {
|
|
64
|
+
type: 'string',
|
|
65
|
+
description: 'Command: "status", "create", "update", "delete", or "set_mode"',
|
|
66
|
+
enum: %w[status create update delete set_mode]
|
|
67
|
+
},
|
|
68
|
+
mode_name: {
|
|
69
|
+
type: 'string',
|
|
70
|
+
description: 'Mode name (resolves to skills/{mode_name}.md). ' \
|
|
71
|
+
'Cannot be "developer", "user", or "none".'
|
|
72
|
+
},
|
|
73
|
+
content: {
|
|
74
|
+
type: 'string',
|
|
75
|
+
description: 'Full markdown content for the instructions file (for create/update)'
|
|
76
|
+
},
|
|
77
|
+
reason: {
|
|
78
|
+
type: 'string',
|
|
79
|
+
description: 'Reason for the change (recorded in blockchain). Required for create/update/delete/set_mode.'
|
|
80
|
+
},
|
|
81
|
+
approved: {
|
|
82
|
+
type: 'boolean',
|
|
83
|
+
description: 'Human approval flag. Must be true to execute L0-level changes.'
|
|
84
|
+
}
|
|
85
|
+
},
|
|
86
|
+
required: %w[command]
|
|
87
|
+
}
|
|
88
|
+
end
|
|
89
|
+
|
|
90
|
+
def call(arguments)
|
|
91
|
+
command = arguments['command']
|
|
92
|
+
mode_name = arguments['mode_name']
|
|
93
|
+
content = arguments['content']
|
|
94
|
+
reason = arguments['reason']
|
|
95
|
+
approved = arguments['approved'] || false
|
|
96
|
+
|
|
97
|
+
# Path traversal protection
|
|
98
|
+
if mode_name && mode_name.match?(%r{[/\\]|\.\.})
|
|
99
|
+
return text_content("Error: mode_name must not contain path separators or '..'")
|
|
100
|
+
end
|
|
101
|
+
|
|
102
|
+
case command
|
|
103
|
+
when 'status'
|
|
104
|
+
handle_status
|
|
105
|
+
when 'create'
|
|
106
|
+
handle_create(mode_name, content, reason, approved)
|
|
107
|
+
when 'update'
|
|
108
|
+
handle_update(mode_name, content, reason, approved)
|
|
109
|
+
when 'delete'
|
|
110
|
+
handle_delete(mode_name, reason, approved)
|
|
111
|
+
when 'set_mode'
|
|
112
|
+
handle_set_mode(mode_name, reason, approved)
|
|
113
|
+
else
|
|
114
|
+
text_content("Unknown command: #{command}")
|
|
115
|
+
end
|
|
116
|
+
end
|
|
117
|
+
|
|
118
|
+
private
|
|
119
|
+
|
|
120
|
+
# --- status command (no approval needed) ---
|
|
121
|
+
|
|
122
|
+
def handle_status
|
|
123
|
+
config = SkillsConfig.load
|
|
124
|
+
current_mode = config['instructions_mode'] || 'user'
|
|
125
|
+
resolved = resolved_path(current_mode)
|
|
126
|
+
|
|
127
|
+
# Find all .md files in skills_dir
|
|
128
|
+
available = Dir[File.join(KairosMcp.skills_dir, '*.md')].sort.map do |f|
|
|
129
|
+
basename = File.basename(f)
|
|
130
|
+
mode = basename.sub(/\.md$/, '')
|
|
131
|
+
builtin = PROTECTED_FILES.include?(basename)
|
|
132
|
+
active = (mode == current_mode) ||
|
|
133
|
+
(current_mode == 'developer' && basename == 'kairos.md') ||
|
|
134
|
+
(current_mode == 'user' && basename == 'kairos_quickguide.md')
|
|
135
|
+
{ file: basename, mode: mode, size: File.size(f), builtin: builtin, active: active }
|
|
136
|
+
end
|
|
137
|
+
|
|
138
|
+
output = "## Instructions Status\n\n"
|
|
139
|
+
output += "**Current mode**: `#{current_mode}`\n"
|
|
140
|
+
output += "**Resolved file**: `#{resolved}`\n"
|
|
141
|
+
output += "**File exists**: #{resolved != '(none)' && File.exist?(resolved)}\n\n"
|
|
142
|
+
output += "### Available instruction files\n\n"
|
|
143
|
+
available.each do |f|
|
|
144
|
+
marker = f[:active] ? ' **(ACTIVE)**' : ''
|
|
145
|
+
tag = f[:builtin] ? ' [built-in]' : ' [custom]'
|
|
146
|
+
output += "- `#{f[:file]}`#{tag}#{marker} (#{f[:size]} bytes)\n"
|
|
147
|
+
end
|
|
148
|
+
|
|
149
|
+
text_content(output)
|
|
150
|
+
end
|
|
151
|
+
|
|
152
|
+
# --- create command ---
|
|
153
|
+
|
|
154
|
+
def handle_create(mode_name, content, reason, approved)
|
|
155
|
+
return text_content("Error: mode_name is required") unless mode_name && !mode_name.empty?
|
|
156
|
+
return text_content("Error: content is required for create") unless content && !content.empty?
|
|
157
|
+
return text_content("Error: reason is required for create") unless reason && !reason.empty?
|
|
158
|
+
return text_content("Error: '#{mode_name}' is a reserved mode name") if RESERVED_MODES.include?(mode_name)
|
|
159
|
+
|
|
160
|
+
path = instructions_path(mode_name)
|
|
161
|
+
return text_content("Error: '#{mode_name}.md' already exists. Use 'update' command.") if File.exist?(path)
|
|
162
|
+
|
|
163
|
+
unless approved
|
|
164
|
+
return text_content(
|
|
165
|
+
"⚠️ Human approval required.\n\n" \
|
|
166
|
+
"**Action**: Create `skills/#{mode_name}.md` (L0-level instructions file)\n" \
|
|
167
|
+
"**Reason**: #{reason}\n" \
|
|
168
|
+
"**Content size**: #{content.length} bytes\n\n" \
|
|
169
|
+
"Set `approved: true` to confirm."
|
|
170
|
+
)
|
|
171
|
+
end
|
|
172
|
+
|
|
173
|
+
FileUtils.mkdir_p(File.dirname(path))
|
|
174
|
+
File.write(path, content)
|
|
175
|
+
|
|
176
|
+
next_hash = Digest::SHA256.hexdigest(content)
|
|
177
|
+
|
|
178
|
+
record_to_blockchain(
|
|
179
|
+
action: 'create_instructions',
|
|
180
|
+
mode_name: mode_name,
|
|
181
|
+
prev_hash: nil,
|
|
182
|
+
next_hash: next_hash,
|
|
183
|
+
reason: reason
|
|
184
|
+
)
|
|
185
|
+
|
|
186
|
+
ActionLog.record(
|
|
187
|
+
action: 'instructions_created',
|
|
188
|
+
skill_id: "instructions:#{mode_name}",
|
|
189
|
+
details: { mode_name: mode_name, next_hash: next_hash, reason: reason }
|
|
190
|
+
)
|
|
191
|
+
|
|
192
|
+
text_content(
|
|
193
|
+
"✅ Instructions file created\n\n" \
|
|
194
|
+
"**File**: `skills/#{mode_name}.md`\n" \
|
|
195
|
+
"**Hash**: `#{next_hash}`\n\n" \
|
|
196
|
+
"Recorded to blockchain (full recording, L0_law level).\n" \
|
|
197
|
+
"Use `set_mode` command to activate this mode."
|
|
198
|
+
)
|
|
199
|
+
rescue StandardError => e
|
|
200
|
+
text_content("❌ Failed: #{e.message}")
|
|
201
|
+
end
|
|
202
|
+
|
|
203
|
+
# --- update command ---
|
|
204
|
+
|
|
205
|
+
def handle_update(mode_name, content, reason, approved)
|
|
206
|
+
return text_content("Error: mode_name is required") unless mode_name && !mode_name.empty?
|
|
207
|
+
return text_content("Error: content is required for update") unless content && !content.empty?
|
|
208
|
+
return text_content("Error: reason is required for update") unless reason && !reason.empty?
|
|
209
|
+
|
|
210
|
+
path = instructions_path(mode_name)
|
|
211
|
+
return text_content("Error: '#{mode_name}.md' not found. Use 'create' command.") unless File.exist?(path)
|
|
212
|
+
|
|
213
|
+
prev_content = File.read(path)
|
|
214
|
+
prev_hash = Digest::SHA256.hexdigest(prev_content)
|
|
215
|
+
next_hash = Digest::SHA256.hexdigest(content)
|
|
216
|
+
|
|
217
|
+
return text_content("No changes detected (same content hash).") if prev_hash == next_hash
|
|
218
|
+
|
|
219
|
+
unless approved
|
|
220
|
+
return text_content(
|
|
221
|
+
"⚠️ Human approval required.\n\n" \
|
|
222
|
+
"**Action**: Update `skills/#{mode_name}.md` (L0-level instructions file)\n" \
|
|
223
|
+
"**Reason**: #{reason}\n" \
|
|
224
|
+
"**Prev hash**: `#{prev_hash[0..15]}...`\n" \
|
|
225
|
+
"**Next hash**: `#{next_hash[0..15]}...`\n\n" \
|
|
226
|
+
"Set `approved: true` to confirm."
|
|
227
|
+
)
|
|
228
|
+
end
|
|
229
|
+
|
|
230
|
+
File.write(path, content)
|
|
231
|
+
|
|
232
|
+
record_to_blockchain(
|
|
233
|
+
action: 'update_instructions',
|
|
234
|
+
mode_name: mode_name,
|
|
235
|
+
prev_hash: prev_hash,
|
|
236
|
+
next_hash: next_hash,
|
|
237
|
+
reason: reason
|
|
238
|
+
)
|
|
239
|
+
|
|
240
|
+
ActionLog.record(
|
|
241
|
+
action: 'instructions_updated',
|
|
242
|
+
skill_id: "instructions:#{mode_name}",
|
|
243
|
+
details: { mode_name: mode_name, prev_hash: prev_hash, next_hash: next_hash, reason: reason }
|
|
244
|
+
)
|
|
245
|
+
|
|
246
|
+
text_content(
|
|
247
|
+
"✅ Instructions file updated\n\n" \
|
|
248
|
+
"**File**: `skills/#{mode_name}.md`\n" \
|
|
249
|
+
"**Prev hash**: `#{prev_hash}`\n" \
|
|
250
|
+
"**Next hash**: `#{next_hash}`\n\n" \
|
|
251
|
+
"Recorded to blockchain (full recording, L0_law level)."
|
|
252
|
+
)
|
|
253
|
+
rescue StandardError => e
|
|
254
|
+
text_content("❌ Failed: #{e.message}")
|
|
255
|
+
end
|
|
256
|
+
|
|
257
|
+
# --- delete command ---
|
|
258
|
+
|
|
259
|
+
def handle_delete(mode_name, reason, approved)
|
|
260
|
+
return text_content("Error: mode_name is required") unless mode_name && !mode_name.empty?
|
|
261
|
+
return text_content("Error: reason is required for delete") unless reason && !reason.empty?
|
|
262
|
+
|
|
263
|
+
filename = "#{mode_name}.md"
|
|
264
|
+
if PROTECTED_FILES.include?(filename)
|
|
265
|
+
return text_content("Error: Cannot delete built-in file '#{filename}'")
|
|
266
|
+
end
|
|
267
|
+
|
|
268
|
+
path = instructions_path(mode_name)
|
|
269
|
+
return text_content("Error: '#{mode_name}.md' not found.") unless File.exist?(path)
|
|
270
|
+
|
|
271
|
+
# Cannot delete active mode
|
|
272
|
+
config = SkillsConfig.load
|
|
273
|
+
current_mode = config['instructions_mode'] || 'user'
|
|
274
|
+
if current_mode == mode_name
|
|
275
|
+
return text_content(
|
|
276
|
+
"Error: Cannot delete '#{mode_name}.md' while it is the active instructions_mode.\n" \
|
|
277
|
+
"Switch to another mode first using `set_mode`."
|
|
278
|
+
)
|
|
279
|
+
end
|
|
280
|
+
|
|
281
|
+
unless approved
|
|
282
|
+
return text_content(
|
|
283
|
+
"⚠️ Human approval required.\n\n" \
|
|
284
|
+
"**Action**: DELETE `skills/#{mode_name}.md` (L0-level instructions file)\n" \
|
|
285
|
+
"**Reason**: #{reason}\n\n" \
|
|
286
|
+
"This action is irreversible.\n" \
|
|
287
|
+
"Set `approved: true` to confirm."
|
|
288
|
+
)
|
|
289
|
+
end
|
|
290
|
+
|
|
291
|
+
prev_content = File.read(path)
|
|
292
|
+
prev_hash = Digest::SHA256.hexdigest(prev_content)
|
|
293
|
+
|
|
294
|
+
File.delete(path)
|
|
295
|
+
|
|
296
|
+
record_to_blockchain(
|
|
297
|
+
action: 'delete_instructions',
|
|
298
|
+
mode_name: mode_name,
|
|
299
|
+
prev_hash: prev_hash,
|
|
300
|
+
next_hash: nil,
|
|
301
|
+
reason: reason
|
|
302
|
+
)
|
|
303
|
+
|
|
304
|
+
ActionLog.record(
|
|
305
|
+
action: 'instructions_deleted',
|
|
306
|
+
skill_id: "instructions:#{mode_name}",
|
|
307
|
+
details: { mode_name: mode_name, prev_hash: prev_hash, reason: reason }
|
|
308
|
+
)
|
|
309
|
+
|
|
310
|
+
text_content(
|
|
311
|
+
"✅ Instructions file deleted\n\n" \
|
|
312
|
+
"**Deleted**: `skills/#{mode_name}.md`\n" \
|
|
313
|
+
"**Prev hash**: `#{prev_hash}`\n\n" \
|
|
314
|
+
"Recorded to blockchain (full recording, L0_law level)."
|
|
315
|
+
)
|
|
316
|
+
rescue StandardError => e
|
|
317
|
+
text_content("❌ Failed: #{e.message}")
|
|
318
|
+
end
|
|
319
|
+
|
|
320
|
+
# --- set_mode command ---
|
|
321
|
+
|
|
322
|
+
def handle_set_mode(mode_name, reason, approved)
|
|
323
|
+
return text_content("Error: mode_name is required") unless mode_name && !mode_name.empty?
|
|
324
|
+
return text_content("Error: reason is required for set_mode") unless reason && !reason.empty?
|
|
325
|
+
|
|
326
|
+
# Validate custom mode file exists
|
|
327
|
+
unless RESERVED_MODES.include?(mode_name)
|
|
328
|
+
path = instructions_path(mode_name)
|
|
329
|
+
unless File.exist?(path)
|
|
330
|
+
return text_content(
|
|
331
|
+
"Error: No instructions file for mode '#{mode_name}'.\n" \
|
|
332
|
+
"Expected: `skills/#{mode_name}.md`\n" \
|
|
333
|
+
"Create it first with the 'create' command."
|
|
334
|
+
)
|
|
335
|
+
end
|
|
336
|
+
end
|
|
337
|
+
|
|
338
|
+
config = SkillsConfig.load
|
|
339
|
+
prev_mode = config['instructions_mode'] || 'user'
|
|
340
|
+
|
|
341
|
+
return text_content("instructions_mode is already '#{mode_name}'.") if prev_mode == mode_name
|
|
342
|
+
|
|
343
|
+
unless approved
|
|
344
|
+
return text_content(
|
|
345
|
+
"⚠️ Human approval required.\n\n" \
|
|
346
|
+
"**Action**: Change instructions_mode `#{prev_mode}` → `#{mode_name}`\n" \
|
|
347
|
+
"**Reason**: #{reason}\n" \
|
|
348
|
+
"**Effect**: AI system prompt will use `skills/#{mode_name}.md` on next connection.\n\n" \
|
|
349
|
+
"Set `approved: true` to confirm."
|
|
350
|
+
)
|
|
351
|
+
end
|
|
352
|
+
|
|
353
|
+
config['instructions_mode'] = mode_name
|
|
354
|
+
SkillsConfig.save(config)
|
|
355
|
+
|
|
356
|
+
record_to_blockchain(
|
|
357
|
+
action: 'set_instructions_mode',
|
|
358
|
+
mode_name: mode_name,
|
|
359
|
+
prev_hash: Digest::SHA256.hexdigest(prev_mode),
|
|
360
|
+
next_hash: Digest::SHA256.hexdigest(mode_name),
|
|
361
|
+
reason: reason
|
|
362
|
+
)
|
|
363
|
+
|
|
364
|
+
ActionLog.record(
|
|
365
|
+
action: 'instructions_mode_changed',
|
|
366
|
+
skill_id: 'instructions_mode',
|
|
367
|
+
details: { prev_mode: prev_mode, new_mode: mode_name, reason: reason }
|
|
368
|
+
)
|
|
369
|
+
|
|
370
|
+
text_content(
|
|
371
|
+
"✅ Instructions mode changed\n\n" \
|
|
372
|
+
"**Previous**: `#{prev_mode}`\n" \
|
|
373
|
+
"**New**: `#{mode_name}`\n\n" \
|
|
374
|
+
"Recorded to blockchain (full recording, L0_law level).\n" \
|
|
375
|
+
"New instructions take effect on next MCP client connection."
|
|
376
|
+
)
|
|
377
|
+
rescue StandardError => e
|
|
378
|
+
text_content("❌ Failed: #{e.message}")
|
|
379
|
+
end
|
|
380
|
+
|
|
381
|
+
# --- helpers ---
|
|
382
|
+
|
|
383
|
+
def instructions_path(mode_name)
|
|
384
|
+
File.join(KairosMcp.skills_dir, "#{mode_name}.md")
|
|
385
|
+
end
|
|
386
|
+
|
|
387
|
+
def resolved_path(mode)
|
|
388
|
+
case mode
|
|
389
|
+
when 'developer' then KairosMcp.md_path
|
|
390
|
+
when 'user' then KairosMcp.quickguide_path
|
|
391
|
+
when 'none' then '(none)'
|
|
392
|
+
else File.join(KairosMcp.skills_dir, "#{mode}.md")
|
|
393
|
+
end
|
|
394
|
+
end
|
|
395
|
+
|
|
396
|
+
def record_to_blockchain(action:, mode_name:, prev_hash:, next_hash:, reason:)
|
|
397
|
+
require_relative '../kairos_chain/chain'
|
|
398
|
+
require_relative '../kairos_chain/skill_transition'
|
|
399
|
+
|
|
400
|
+
transition = KairosChain::SkillTransition.new(
|
|
401
|
+
skill_id: "instructions:#{mode_name}",
|
|
402
|
+
prev_ast_hash: prev_hash || 'nil',
|
|
403
|
+
next_ast_hash: next_hash || 'nil',
|
|
404
|
+
diff_hash: Digest::SHA256.hexdigest("#{prev_hash}#{next_hash}"),
|
|
405
|
+
reason_ref: "#{action}: #{reason}"
|
|
406
|
+
)
|
|
407
|
+
|
|
408
|
+
chain = KairosChain::Chain.new
|
|
409
|
+
chain.add_block([transition.to_json])
|
|
410
|
+
rescue StandardError => e
|
|
411
|
+
$stderr.puts "[InstructionsUpdate] Blockchain recording failed: #{e.message}"
|
|
412
|
+
end
|
|
413
|
+
end
|
|
414
|
+
end
|
|
415
|
+
end
|
data/lib/kairos_mcp/version.rb
CHANGED
data/lib/kairos_mcp.rb
CHANGED
|
@@ -13,20 +13,22 @@ module KairosMcp
|
|
|
13
13
|
# Format: [template_relative_path, data_dir_accessor_symbol]
|
|
14
14
|
#
|
|
15
15
|
TEMPLATE_FILES = [
|
|
16
|
-
['skills/kairos.rb',
|
|
17
|
-
['skills/kairos.md',
|
|
18
|
-
['skills/
|
|
19
|
-
['config
|
|
20
|
-
['config/
|
|
16
|
+
['skills/kairos.rb', :dsl_path],
|
|
17
|
+
['skills/kairos.md', :md_path],
|
|
18
|
+
['skills/kairos_quickguide.md', :quickguide_path],
|
|
19
|
+
['skills/config.yml', :skills_config_path],
|
|
20
|
+
['config/safety.yml', :safety_config_path],
|
|
21
|
+
['config/tool_metadata.yml', :tool_metadata_path]
|
|
21
22
|
].freeze
|
|
22
23
|
|
|
23
24
|
# File type classification for upgrade conflict resolution
|
|
24
25
|
TEMPLATE_FILE_TYPES = {
|
|
25
|
-
'skills/kairos.rb'
|
|
26
|
-
'skills/kairos.md'
|
|
27
|
-
'skills/
|
|
28
|
-
'config
|
|
29
|
-
'config/
|
|
26
|
+
'skills/kairos.rb' => :l0_dsl,
|
|
27
|
+
'skills/kairos.md' => :l0_doc,
|
|
28
|
+
'skills/kairos_quickguide.md' => :l0_doc,
|
|
29
|
+
'skills/config.yml' => :config_yaml,
|
|
30
|
+
'config/safety.yml' => :config_yaml,
|
|
31
|
+
'config/tool_metadata.yml' => :config_yaml
|
|
30
32
|
}.freeze
|
|
31
33
|
|
|
32
34
|
# =========================================================================
|
|
@@ -85,6 +87,11 @@ module KairosMcp
|
|
|
85
87
|
File.join(skills_dir, 'kairos.md')
|
|
86
88
|
end
|
|
87
89
|
|
|
90
|
+
# L0 skills quick guide file path (user-facing instructions)
|
|
91
|
+
def quickguide_path
|
|
92
|
+
File.join(skills_dir, 'kairos_quickguide.md')
|
|
93
|
+
end
|
|
94
|
+
|
|
88
95
|
# L0 skills config file path
|
|
89
96
|
def skills_config_path
|
|
90
97
|
File.join(skills_dir, 'config.yml')
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: kairoschain_operations
|
|
3
3
|
description: "Future roadmap, deployment, and operations guide"
|
|
4
|
-
version: 1.
|
|
4
|
+
version: 1.1
|
|
5
5
|
layer: L1
|
|
6
6
|
tags: [documentation, readme, operations, deployment, roadmap, backup]
|
|
7
7
|
readme_order: 5
|
|
@@ -10,13 +10,33 @@ readme_lang: en
|
|
|
10
10
|
|
|
11
11
|
## Future Roadmap
|
|
12
12
|
|
|
13
|
+
### Completed Phases
|
|
14
|
+
|
|
15
|
+
The following development phases have been completed on the `feature/skillset-plugin` branch:
|
|
16
|
+
|
|
17
|
+
| Phase | Description | Key Deliverables |
|
|
18
|
+
|-------|-------------|-----------------|
|
|
19
|
+
| **Phase 1** | SkillSet Plugin Infrastructure | SkillSetManager, ToolRegistry extension, CLI subcommands, layer-based governance |
|
|
20
|
+
| **Phase 2** | MMP as SkillSet + P2P Direct Mode | MMP packaged as standalone SkillSet, MeetingRouter with 8 HTTP endpoints, 4 MCP tools |
|
|
21
|
+
| **Phase 2.5** | P2P Local Tests | 72 assertions across 4 test sections |
|
|
22
|
+
| **Phase 3** | Knowledge-only SkillSet Exchange | `knowledge_only?`/`exchangeable?` checks, tar.gz archive packaging, 3 new SkillSet endpoints |
|
|
23
|
+
| **Phase 3.5** | Security Fixes + Wire Protocol Spec | Name sanitization (H4), path traversal guard (H1), extended executable detection (H5), wire protocol specification |
|
|
24
|
+
| **Phase 3.7** | Pre-Phase 4 Hardening | RSA-2048 signature verification, semantic version constraints, PeerManager persistence, TOFU trust model |
|
|
25
|
+
| **Phase 3.75** | MMP Extension Infrastructure | Collision detection for core actions, extension override guards, pre-Phase 4 preparation |
|
|
26
|
+
| **Phase 4.pre** | Authentication + Hardening | Admin token rotation, session-based auth for P2P endpoints |
|
|
27
|
+
| **Phase 4A** | HestiaChain Foundation | Self-contained trust anchor SkillSet, DEE protocol (PhilosophyDeclaration, ObservationLog), chain migration (4 stages), 4 MCP tools, 77 test assertions |
|
|
28
|
+
| **Phase 4B** | Meeting Place Server | PlaceRouter, AgentRegistry, SkillBoard, HeartbeatManager, 6 HTTP endpoints, 2 MCP tools, 70 test assertions |
|
|
29
|
+
|
|
30
|
+
Test results: 356 passed, 0 failed (v2.0.0).
|
|
31
|
+
|
|
13
32
|
### Near-term
|
|
14
33
|
|
|
15
|
-
1. **
|
|
16
|
-
2. **
|
|
17
|
-
3. **
|
|
18
|
-
4. **
|
|
19
|
-
5. **
|
|
34
|
+
1. **Phase 4C: Message Relay**: E2E encrypted message relay with TTL (`/place/v1/relay/*`)
|
|
35
|
+
2. **Phase 4D: Federation**: Inter-Place discovery and mutual registration
|
|
36
|
+
3. **Ethereum Anchor**: Periodic hash anchoring to public chain (HestiaChain stages 2/3)
|
|
37
|
+
4. **Zero-Knowledge Proofs**: Privacy-preserving verification
|
|
38
|
+
5. **Web Dashboard**: Visualize skill evolution history
|
|
39
|
+
6. **Team Governance**: Voting system for L0 changes (see FAQ)
|
|
20
40
|
|
|
21
41
|
### Long-term Vision: Distributed KairosChain Network
|
|
22
42
|
|
|
@@ -30,10 +50,12 @@ A future vision for KairosChain: multiple KairosChain MCP servers communicating
|
|
|
30
50
|
|
|
31
51
|
**Implementation phases**:
|
|
32
52
|
1. Dockerization (deployment foundation)
|
|
33
|
-
2. ~~HTTP/WebSocket API (remote access)~~ ✅ Streamable HTTP transport (
|
|
34
|
-
3. Inter-server communication protocol
|
|
35
|
-
4.
|
|
36
|
-
5.
|
|
53
|
+
2. ~~HTTP/WebSocket API (remote access)~~ ✅ Streamable HTTP transport (complete)
|
|
54
|
+
3. ~~Inter-server communication protocol~~ ✅ MMP (Model Meeting Protocol) with P2P direct mode (complete)
|
|
55
|
+
4. ~~SkillSet Plugin Infrastructure~~ ✅ Layer-based governance, knowledge-only P2P exchange (complete)
|
|
56
|
+
5. ~~HestiaChain Meeting Place Server~~ ✅ Trust anchor + DEE protocol Meeting Place (complete, v2.0.0)
|
|
57
|
+
6. Distributed consensus mechanism
|
|
58
|
+
7. Distributed L0 governance
|
|
37
59
|
|
|
38
60
|
For detailed vision document, see: [Distributed KairosChain Network Vision](docs/distributed_kairoschain_vision_20260128_en.md)
|
|
39
61
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: kairoschain_operations_jp
|
|
3
3
|
description: 将来のロードマップ、デプロイ、運用ガイド
|
|
4
|
-
version: 1.
|
|
4
|
+
version: 1.1
|
|
5
5
|
layer: L1
|
|
6
6
|
tags: [documentation, readme, operations, deployment, roadmap, backup]
|
|
7
7
|
readme_order: 5
|
|
@@ -10,13 +10,33 @@ readme_lang: jp
|
|
|
10
10
|
|
|
11
11
|
## 将来のロードマップ
|
|
12
12
|
|
|
13
|
+
### 完了済みフェーズ
|
|
14
|
+
|
|
15
|
+
以下の開発フェーズが`feature/skillset-plugin`ブランチで完了しています:
|
|
16
|
+
|
|
17
|
+
| フェーズ | 説明 | 主な成果物 |
|
|
18
|
+
|---------|------|-----------|
|
|
19
|
+
| **Phase 1** | SkillSetプラグイン基盤 | SkillSetManager、ToolRegistry拡張、CLIサブコマンド、レイヤーベースガバナンス |
|
|
20
|
+
| **Phase 2** | MMP as SkillSet + P2Pダイレクトモード | MMPをスタンドアロンSkillSetとしてパッケージ化、MeetingRouter(8 HTTPエンドポイント)、4 MCPツール |
|
|
21
|
+
| **Phase 2.5** | P2Pローカルテスト | 4テストセクション、72アサーション |
|
|
22
|
+
| **Phase 3** | Knowledge-only SkillSet交換 | `knowledge_only?`/`exchangeable?`チェック、tar.gzアーカイブパッケージング、3つの新SkillSetエンドポイント |
|
|
23
|
+
| **Phase 3.5** | セキュリティ修正 + ワイヤープロトコル仕様 | 名前サニタイズ(H4)、パストラバーサルガード(H1)、拡張実行可能ファイル検出(H5)、ワイヤープロトコル仕様書 |
|
|
24
|
+
| **Phase 3.7** | Phase 4前の堅牢化 | RSA-2048署名検証、セマンティックバージョン制約、PeerManager永続化、TOFUトラストモデル |
|
|
25
|
+
| **Phase 3.75** | MMP拡張基盤 | コアアクション衝突検出、拡張オーバーライドガード、Phase 4準備 |
|
|
26
|
+
| **Phase 4.pre** | 認証 + 堅牢化 | Admin トークンローテーション、P2Pエンドポイントのセッションベース認証 |
|
|
27
|
+
| **Phase 4A** | HestiaChain Foundation | 自己完結型信頼アンカーSkillSet、DEEプロトコル(PhilosophyDeclaration、ObservationLog)、チェーン移行(4ステージ)、4 MCPツール、77テストアサーション |
|
|
28
|
+
| **Phase 4B** | Meeting Placeサーバー | PlaceRouter、AgentRegistry、SkillBoard、HeartbeatManager、6 HTTPエンドポイント、2 MCPツール、70テストアサーション |
|
|
29
|
+
|
|
30
|
+
テスト結果: 356テスト通過、0失敗(v2.0.0)。
|
|
31
|
+
|
|
13
32
|
### 近期
|
|
14
33
|
|
|
15
|
-
1. **
|
|
16
|
-
2.
|
|
17
|
-
3.
|
|
18
|
-
4.
|
|
19
|
-
5.
|
|
34
|
+
1. **Phase 4C: メッセージリレー**:TTL付きE2E暗号化メッセージリレー(`/place/v1/relay/*`)
|
|
35
|
+
2. **Phase 4D: フェデレーション**:Place間の発見と相互登録
|
|
36
|
+
3. **Ethereumアンカー**:公開チェーンへの定期的なハッシュアンカリング(HestiaChainステージ2/3)
|
|
37
|
+
4. **ゼロ知識証明**:プライバシーを保護した検証
|
|
38
|
+
5. **Webダッシュボード**:スキル進化履歴の可視化
|
|
39
|
+
6. **チームガバナンス**:L0変更のための投票システム(FAQを参照)
|
|
20
40
|
|
|
21
41
|
### 長期ビジョン:分散KairosChainネットワーク
|
|
22
42
|
|
|
@@ -30,10 +50,12 @@ KairosChainの将来構想:複数のKairosChain MCPサーバーがインター
|
|
|
30
50
|
|
|
31
51
|
**実装フェーズ**:
|
|
32
52
|
1. Docker化(デプロイメント基盤)
|
|
33
|
-
2. ~~HTTP/WebSocket API(リモートアクセス)~~ ✅ Streamable HTTP
|
|
34
|
-
3.
|
|
35
|
-
4.
|
|
36
|
-
5.
|
|
53
|
+
2. ~~HTTP/WebSocket API(リモートアクセス)~~ ✅ Streamable HTTPトランスポート(完了)
|
|
54
|
+
3. ~~サーバー間通信プロトコル~~ ✅ MMP(Model Meeting Protocol)P2Pダイレクトモード(完了)
|
|
55
|
+
4. ~~SkillSetプラグイン基盤~~ ✅ レイヤーベースガバナンス、knowledge-only P2P交換(完了)
|
|
56
|
+
5. ~~HestiaChain Meeting Placeサーバー~~ ✅ 信頼アンカー + DEEプロトコルによるMeeting Place(完了、v2.0.0)
|
|
57
|
+
6. 分散合意メカニズム
|
|
58
|
+
7. L0分散ガバナンス
|
|
37
59
|
|
|
38
60
|
詳細なビジョンドキュメント: [分散KairosChainネットワーク構想](docs/distributed_kairoschain_vision_20260128_jp.md)
|
|
39
61
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: kairoschain_usage
|
|
3
3
|
description: "KairosChain tools reference, usage patterns, and evolution workflow"
|
|
4
|
-
version: 1.
|
|
4
|
+
version: 1.1
|
|
5
5
|
layer: L1
|
|
6
6
|
tags: [documentation, readme, usage, tools, workflow, examples]
|
|
7
7
|
readme_order: 3
|
|
@@ -192,9 +192,9 @@ The `tool_guide` tool helps you discover and learn about KairosChain tools dynam
|
|
|
192
192
|
- All operations are recorded in `action_log`
|
|
193
193
|
- Review logs regularly
|
|
194
194
|
|
|
195
|
-
## Available Tools (
|
|
195
|
+
## Available Tools (26 core + skill-tools)
|
|
196
196
|
|
|
197
|
-
The base installation provides
|
|
197
|
+
The base installation provides 25 tools (24 + 1 HTTP-only). Additional tools can be defined via `tool` blocks in `kairos.rb` when `skill_tools_enabled: true`.
|
|
198
198
|
|
|
199
199
|
### L0-A: Skills Tools (Markdown) - Read-only
|
|
200
200
|
|
|
@@ -214,6 +214,21 @@ The base installation provides 24 tools (23 + 1 HTTP-only). Additional tools can
|
|
|
214
214
|
|
|
215
215
|
> **Skill-defined tools**: When `skill_tools_enabled: true`, skills with `tool` blocks in `kairos.rb` are also registered here as MCP tools.
|
|
216
216
|
|
|
217
|
+
### L0: Instructions Management - Full Blockchain Record
|
|
218
|
+
|
|
219
|
+
| Tool | Description |
|
|
220
|
+
|------|-------------|
|
|
221
|
+
| `instructions_update` | Create, update, or delete custom instruction files and switch instructions_mode (L0-level, requires human approval) |
|
|
222
|
+
|
|
223
|
+
Commands:
|
|
224
|
+
- `status`: Show current mode and available instruction files
|
|
225
|
+
- `create`: Create a new instructions file (`skills/{mode_name}.md`)
|
|
226
|
+
- `update`: Update existing instructions file content
|
|
227
|
+
- `delete`: Delete a custom instructions file (built-in files protected)
|
|
228
|
+
- `set_mode`: Change `instructions_mode` in config.yml
|
|
229
|
+
|
|
230
|
+
Dynamic mode resolution: Setting `instructions_mode: 'researcher'` in config.yml loads `skills/researcher.md` as the AI system prompt instructions. Built-in modes (`developer`, `user`, `none`) are preserved.
|
|
231
|
+
|
|
217
232
|
### Cross-Layer Promotion Tools
|
|
218
233
|
|
|
219
234
|
| Tool | Description |
|
|
@@ -329,6 +344,35 @@ Commands:
|
|
|
329
344
|
- `apply`: Execute upgrade (requires `approved=true`)
|
|
330
345
|
- `status`: Show `.kairos_meta.yml` status
|
|
331
346
|
|
|
347
|
+
### MMP Meeting Tools (SkillSet: mmp)
|
|
348
|
+
|
|
349
|
+
These tools are available when the MMP (Model Meeting Protocol) SkillSet is installed and enabled. MMP enables P2P communication and knowledge exchange between KairosChain instances.
|
|
350
|
+
|
|
351
|
+
| Tool | Description |
|
|
352
|
+
|------|-------------|
|
|
353
|
+
| `meeting_connect` | Connect to a remote KairosChain peer via MMP |
|
|
354
|
+
| `meeting_disconnect` | Disconnect from a peer session |
|
|
355
|
+
| `meeting_acquire_skill` | Acquire a skill or SkillSet from a connected peer |
|
|
356
|
+
| `meeting_get_skill_details` | Get metadata about a peer's available skills |
|
|
357
|
+
|
|
358
|
+
MMP SkillSet also exposes HTTP endpoints via MeetingRouter (`/meeting/v1/*`):
|
|
359
|
+
|
|
360
|
+
| Endpoint | Method | Description |
|
|
361
|
+
|----------|--------|-------------|
|
|
362
|
+
| `/meeting/v1/introduce` | GET | Self-introduction (identity, capabilities) |
|
|
363
|
+
| `/meeting/v1/introduce` | POST | Receive peer introduction |
|
|
364
|
+
| `/meeting/v1/skills` | GET | List public skills |
|
|
365
|
+
| `/meeting/v1/skill_details` | GET | Get skill metadata (`?skill_id=X`) |
|
|
366
|
+
| `/meeting/v1/skill_content` | POST | Request skill content |
|
|
367
|
+
| `/meeting/v1/request_skill` | POST | Submit skill request |
|
|
368
|
+
| `/meeting/v1/reflect` | POST | Send reflection |
|
|
369
|
+
| `/meeting/v1/message` | POST | Generic MMP message |
|
|
370
|
+
| `/meeting/v1/skillsets` | GET | List exchangeable SkillSets |
|
|
371
|
+
| `/meeting/v1/skillset_details` | GET | Get SkillSet metadata (`?name=X`) |
|
|
372
|
+
| `/meeting/v1/skillset_content` | POST | Download SkillSet archive |
|
|
373
|
+
|
|
374
|
+
> **Knowledge-only constraint**: Only non-executable content (Markdown, YAML) can be exchanged over P2P. SkillSets containing executable code (`tools/`, `lib/` with .rb, .py, .sh, etc.) must be installed via trusted channels. See the [MMP P2P User Guide](docs/KairosChain_MMP_P2P_UserGuide_20260220_en.md) for details.
|
|
375
|
+
|
|
332
376
|
## Usage Examples
|
|
333
377
|
|
|
334
378
|
### List Available Skills
|
|
@@ -349,6 +393,30 @@ echo '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"chain_stat
|
|
|
349
393
|
echo '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"chain_record","arguments":{"logs":["Skill X modified","Reason: improved accuracy"]}}}' | kairos-chain
|
|
350
394
|
```
|
|
351
395
|
|
|
396
|
+
### P2P SkillSet Exchange
|
|
397
|
+
|
|
398
|
+
```bash
|
|
399
|
+
# 1. Start HTTP server for P2P (on Agent A)
|
|
400
|
+
kairos-chain --http --port 8080
|
|
401
|
+
|
|
402
|
+
# 2. Connect from Agent B
|
|
403
|
+
echo '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"meeting_connect","arguments":{"url":"http://localhost:8080","mode":"direct"}}}' | kairos-chain
|
|
404
|
+
|
|
405
|
+
# 3. List peer's available skills
|
|
406
|
+
curl http://localhost:8080/meeting/v1/skills
|
|
407
|
+
|
|
408
|
+
# 4. Get SkillSet details
|
|
409
|
+
curl "http://localhost:8080/meeting/v1/skillset_details?name=my_knowledge_set"
|
|
410
|
+
|
|
411
|
+
# 5. Download SkillSet archive
|
|
412
|
+
curl -X POST http://localhost:8080/meeting/v1/skillset_content \
|
|
413
|
+
-H "Content-Type: application/json" \
|
|
414
|
+
-d '{"name":"my_knowledge_set"}'
|
|
415
|
+
|
|
416
|
+
# 6. Install received archive
|
|
417
|
+
kairos-chain skillset install-archive received_package.json
|
|
418
|
+
```
|
|
419
|
+
|
|
352
420
|
## Self-Evolution Workflow
|
|
353
421
|
|
|
354
422
|
KairosChain supports **Safe Self-Evolution**:
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: kairoschain_usage_jp
|
|
3
3
|
description: KairosChainのツール一覧、使用方法、進化ワークフロー
|
|
4
|
-
version: 1.
|
|
4
|
+
version: 1.1
|
|
5
5
|
layer: L1
|
|
6
6
|
tags: [documentation, readme, usage, tools, workflow, examples]
|
|
7
7
|
readme_order: 3
|
|
@@ -192,9 +192,9 @@ cp -r skills/versions skills/backups/versions_$(date +%Y%m%d)
|
|
|
192
192
|
- すべての操作は`action_log`に記録される
|
|
193
193
|
- 定期的にログをレビュー
|
|
194
194
|
|
|
195
|
-
## 利用可能なツール(コア
|
|
195
|
+
## 利用可能なツール(コア26個 + スキルツール)
|
|
196
196
|
|
|
197
|
-
基本インストールでは24
|
|
197
|
+
基本インストールでは25個のツール(24 + HTTP専用1個)が提供されます。`skill_tools_enabled: true`の場合、`kairos.rb`の`tool`ブロックで追加のツールを定義できます。
|
|
198
198
|
|
|
199
199
|
### L0-A:スキルツール(Markdown) - 読み取り専用
|
|
200
200
|
|
|
@@ -214,6 +214,21 @@ cp -r skills/versions skills/backups/versions_$(date +%Y%m%d)
|
|
|
214
214
|
|
|
215
215
|
> **スキル定義ツール**:`skill_tools_enabled: true`の場合、`kairos.rb`内の`tool`ブロックを持つスキルもここにMCPツールとして登録されます。
|
|
216
216
|
|
|
217
|
+
### L0:インストラクション管理 - 完全なブロックチェーン記録
|
|
218
|
+
|
|
219
|
+
| ツール | 説明 |
|
|
220
|
+
|--------|------|
|
|
221
|
+
| `instructions_update` | カスタムインストラクションファイルの作成/更新/削除とinstructions_modeの切り替え(L0レベル、人間の承認が必要) |
|
|
222
|
+
|
|
223
|
+
コマンド:
|
|
224
|
+
- `status`: 現在のmodeと利用可能なインストラクションファイル一覧を表示
|
|
225
|
+
- `create`: 新規インストラクションファイル(`skills/{mode_name}.md`)を作成
|
|
226
|
+
- `update`: 既存インストラクションファイルの内容を更新
|
|
227
|
+
- `delete`: カスタムインストラクションファイルを削除(built-inファイルは保護)
|
|
228
|
+
- `set_mode`: config.ymlの`instructions_mode`を変更
|
|
229
|
+
|
|
230
|
+
動的モード解決: config.ymlで`instructions_mode: 'researcher'`を設定すると、`skills/researcher.md`がAIシステムプロンプトのinstructionsとしてロードされます。組み込みモード(`developer`、`user`、`none`)は従来通り維持されます。
|
|
231
|
+
|
|
217
232
|
### クロスレイヤー昇格ツール
|
|
218
233
|
|
|
219
234
|
| ツール | 説明 |
|
|
@@ -329,6 +344,35 @@ KairosChainツールを発見し学ぶための動的ツールガイドシステ
|
|
|
329
344
|
- `apply`: アップグレードを実行(`approved=true`が必要)
|
|
330
345
|
- `status`: `.kairos_meta.yml`の状態を表示
|
|
331
346
|
|
|
347
|
+
### MMP Meetingツール(SkillSet: mmp)
|
|
348
|
+
|
|
349
|
+
MMP(Model Meeting Protocol)SkillSetがインストール・有効化されている場合に利用可能なツールです。MMPはKairosChainインスタンス間のP2P通信と知識交換を実現します。
|
|
350
|
+
|
|
351
|
+
| ツール | 説明 |
|
|
352
|
+
|--------|------|
|
|
353
|
+
| `meeting_connect` | MMP経由でリモートのKairosChainピアに接続 |
|
|
354
|
+
| `meeting_disconnect` | ピアセッションから切断 |
|
|
355
|
+
| `meeting_acquire_skill` | 接続先のピアからスキルまたはSkillSetを取得 |
|
|
356
|
+
| `meeting_get_skill_details` | ピアの利用可能なスキルのメタデータを取得 |
|
|
357
|
+
|
|
358
|
+
MMP SkillSetはMeetingRouter経由でHTTPエンドポイント(`/meeting/v1/*`)も公開します:
|
|
359
|
+
|
|
360
|
+
| エンドポイント | メソッド | 説明 |
|
|
361
|
+
|---------------|---------|------|
|
|
362
|
+
| `/meeting/v1/introduce` | GET | 自己紹介(ID、capabilities) |
|
|
363
|
+
| `/meeting/v1/introduce` | POST | ピアの紹介を受信 |
|
|
364
|
+
| `/meeting/v1/skills` | GET | 公開スキル一覧 |
|
|
365
|
+
| `/meeting/v1/skill_details` | GET | スキルメタデータ取得(`?skill_id=X`) |
|
|
366
|
+
| `/meeting/v1/skill_content` | POST | スキルコンテンツを要求 |
|
|
367
|
+
| `/meeting/v1/request_skill` | POST | スキルリクエストを送信 |
|
|
368
|
+
| `/meeting/v1/reflect` | POST | リフレクションを送信 |
|
|
369
|
+
| `/meeting/v1/message` | POST | 汎用MMPメッセージ |
|
|
370
|
+
| `/meeting/v1/skillsets` | GET | 交換可能なSkillSet一覧 |
|
|
371
|
+
| `/meeting/v1/skillset_details` | GET | SkillSetメタデータ取得(`?name=X`) |
|
|
372
|
+
| `/meeting/v1/skillset_content` | POST | SkillSetアーカイブをダウンロード |
|
|
373
|
+
|
|
374
|
+
> **Knowledge-only制約**: P2P経由で交換できるのは非実行コンテンツ(Markdown, YAML)のみです。実行可能コード(`tools/`, `lib/`内の.rb, .py, .sh等)を含むSkillSetは信頼されたチャネル経由でインストールする必要があります。詳細は[MMP P2Pユーザーガイド](docs/KairosChain_MMP_P2P_UserGuide_20260220_jp.md)を参照してください。
|
|
375
|
+
|
|
332
376
|
## 使用例
|
|
333
377
|
|
|
334
378
|
### 利用可能なスキルを一覧表示
|
|
@@ -349,6 +393,30 @@ echo '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"chain_stat
|
|
|
349
393
|
echo '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"chain_record","arguments":{"logs":["Skill X modified","Reason: improved accuracy"]}}}' | kairos-chain
|
|
350
394
|
```
|
|
351
395
|
|
|
396
|
+
### P2P SkillSet交換
|
|
397
|
+
|
|
398
|
+
```bash
|
|
399
|
+
# 1. P2P用HTTPサーバーを起動(エージェントA側)
|
|
400
|
+
kairos-chain --http --port 8080
|
|
401
|
+
|
|
402
|
+
# 2. エージェントBから接続
|
|
403
|
+
echo '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"meeting_connect","arguments":{"url":"http://localhost:8080","mode":"direct"}}}' | kairos-chain
|
|
404
|
+
|
|
405
|
+
# 3. ピアの利用可能なスキルを一覧表示
|
|
406
|
+
curl http://localhost:8080/meeting/v1/skills
|
|
407
|
+
|
|
408
|
+
# 4. SkillSetの詳細を取得
|
|
409
|
+
curl "http://localhost:8080/meeting/v1/skillset_details?name=my_knowledge_set"
|
|
410
|
+
|
|
411
|
+
# 5. SkillSetアーカイブをダウンロード
|
|
412
|
+
curl -X POST http://localhost:8080/meeting/v1/skillset_content \
|
|
413
|
+
-H "Content-Type: application/json" \
|
|
414
|
+
-d '{"name":"my_knowledge_set"}'
|
|
415
|
+
|
|
416
|
+
# 6. 受信したアーカイブをインストール
|
|
417
|
+
kairos-chain skillset install-archive received_package.json
|
|
418
|
+
```
|
|
419
|
+
|
|
352
420
|
## 自己進化ワークフロー
|
|
353
421
|
|
|
354
422
|
KairosChainは**安全な自己進化**をサポートします:
|
data/templates/skills/config.yml
CHANGED
|
@@ -4,6 +4,12 @@
|
|
|
4
4
|
# General settings
|
|
5
5
|
enabled: true
|
|
6
6
|
evolution_enabled: false
|
|
7
|
+
|
|
8
|
+
# Instructions mode: Controls what context is sent to LLM on MCP connection
|
|
9
|
+
# developer: Full philosophy (kairos.md) - for KairosChain contributors
|
|
10
|
+
# user: Quick guide only (kairos_quickguide.md) - for general users (default)
|
|
11
|
+
# none: No instructions - minimal context window usage
|
|
12
|
+
instructions_mode: user
|
|
7
13
|
max_evolutions_per_session: 3
|
|
8
14
|
require_human_approval: true
|
|
9
15
|
|
data/templates/skills/kairos.md
CHANGED
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
| Section ID | Title | Use When |
|
|
4
4
|
|------------|-------|----------|
|
|
5
|
+
| PHILOSOPHY-001 | Generative Principle | Understanding the single principle from which KairosChain's architecture flows |
|
|
6
|
+
| PHILOSOPHY-005 | Five Propositions | Understanding the core propositions that summarize KairosChain's design |
|
|
5
7
|
| PHILOSOPHY-010 | Core Philosophy | Understanding Kairos's fundamental vision |
|
|
6
8
|
| PHILOSOPHY-020 | Minimum-Nomic | Understanding the change constraint principle |
|
|
7
9
|
| PRINCIPLE-010 | Safety Principles | Understanding safety invariants |
|
|
@@ -11,6 +13,34 @@
|
|
|
11
13
|
|
|
12
14
|
---
|
|
13
15
|
|
|
16
|
+
## [PHILOSOPHY-001] Generative Principle: Structural Self-Referentiality
|
|
17
|
+
|
|
18
|
+
KairosChain's entire architecture flows from one principle:
|
|
19
|
+
|
|
20
|
+
> **Meta-level operations are expressed in the same structure as base-level operations.**
|
|
21
|
+
|
|
22
|
+
This is why Ruby (DSL/AST) was chosen. "Defining a Skill" and "defining the evolution rules for a Skill" use the same language, syntax, and runtime. This structural correspondence is the foundation of self-referentiality, and all other properties of KairosChain germinate from it.
|
|
23
|
+
|
|
24
|
+
Self-referentiality is not a design choice but an existential condition: without definitional closure at L0, the system would be "a program following configuration" rather than "an entity that defines its own conditions of existence."
|
|
25
|
+
|
|
26
|
+
---
|
|
27
|
+
|
|
28
|
+
## [PHILOSOPHY-005] Five Propositions
|
|
29
|
+
|
|
30
|
+
The following five propositions summarize the philosophical structure of KairosChain. They are not axioms from which everything is derived, but patterns whose recursive application at different levels produces different properties.
|
|
31
|
+
|
|
32
|
+
1. **Self-referentiality and metacognition as generative seed** — A pattern whose recursive application at different levels produces different properties. Intentionally asymmetric: strongest at L0 governance core, pragmatically open at infrastructure level ("sufficient self-referentiality"). Self-referentiality is structural (L0 defining itself); metacognition is cognitive (self_inspection evaluating the system's own state). Both dimensions are core.
|
|
33
|
+
|
|
34
|
+
2. **Dual integrity guarantee** — Prevention (approval_workflow's 5-layer validation) + structural impossibility (a contradictory self-referential system cannot operate). The latter holds within legitimate operation paths only.
|
|
35
|
+
|
|
36
|
+
3. **Structure opens possibility space; design realizes it** — Self-referential structure automatically enables recursive extension. Individual SkillSets (MMP, HestiaChain) are engineered, but the *possibility* of expressing meta-capabilities as SkillSets is a structural consequence, not a design decision.
|
|
37
|
+
|
|
38
|
+
4. **Circular integration of process and result** — Operation, evolution, and recording are functionally separated but ontologically unified through the same Skill structure. Time is Kairos (qualitative moment), not Chronos (quantitative flow).
|
|
39
|
+
|
|
40
|
+
5. **Partial autopoiesis** — Self-production loop closes at the governance/capability-definition level; depends on external substrates (Ruby VM, filesystem) at the execution level. The question is "at which abstraction level does the loop close?" — not "is it complete?"
|
|
41
|
+
|
|
42
|
+
---
|
|
43
|
+
|
|
14
44
|
## [PHILOSOPHY-010] Core Philosophy
|
|
15
45
|
|
|
16
46
|
### The Core Insight
|
data/templates/skills/kairos.rb
CHANGED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# KairosChain Quick Guide
|
|
2
|
+
|
|
3
|
+
KairosChain is a Meta Ledger for AI capability evolution.
|
|
4
|
+
It manages knowledge in 3 layers with different levels of control.
|
|
5
|
+
|
|
6
|
+
## Layers
|
|
7
|
+
|
|
8
|
+
- **L2 (context/)** — Free scratchpad. Start here. No approval needed, no recording.
|
|
9
|
+
- **L1 (knowledge/)** — Project knowledge. Lightweight hash recording on blockchain.
|
|
10
|
+
- **L0 (skills/)** — System governance rules. Requires human approval. Fully recorded.
|
|
11
|
+
|
|
12
|
+
**Rule of thumb:** If unsure where to put something, use L2 first. Promote to L1 later if it proves valuable.
|
|
13
|
+
|
|
14
|
+
## Getting Started
|
|
15
|
+
|
|
16
|
+
| Goal | Tool | Example |
|
|
17
|
+
|------|------|---------|
|
|
18
|
+
| Save notes or ideas | `context_save` | `context_save(session_id: "my_session", name: "idea", content: "...")` |
|
|
19
|
+
| List project knowledge | `knowledge_list` | `knowledge_list()` |
|
|
20
|
+
| Update knowledge | `knowledge_update` | `knowledge_update(name: "conventions", content: "...")` |
|
|
21
|
+
| Browse all tools | `tool_guide` | `tool_guide(command: "catalog")` |
|
|
22
|
+
| Check system health | `chain_status` | `chain_status()` |
|
|
23
|
+
|
|
24
|
+
## Safety Notes
|
|
25
|
+
|
|
26
|
+
- L0 changes require explicit human approval — the system will prompt you
|
|
27
|
+
- `core_safety` skill is immutable and cannot be modified
|
|
28
|
+
- All L0 and L1 changes are automatically recorded on the blockchain
|
|
29
|
+
- Evolution (L0 self-modification) is disabled by default
|
|
30
|
+
|
|
31
|
+
## Learn More
|
|
32
|
+
|
|
33
|
+
Use `skills_list` and `skills_get` to read KairosChain's full philosophy.
|
|
34
|
+
Use `tool_guide(command: "workflow")` to see common workflow patterns.
|
metadata
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: kairos-chain
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 2.0.
|
|
4
|
+
version: 2.0.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Masa Hatakeyama
|
|
8
|
-
autorequire:
|
|
8
|
+
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
11
|
date: 2026-02-23 00:00:00.000000000 Z
|
|
@@ -126,6 +126,7 @@ files:
|
|
|
126
126
|
- lib/kairos_mcp/tools/context_create_subdir.rb
|
|
127
127
|
- lib/kairos_mcp/tools/context_save.rb
|
|
128
128
|
- lib/kairos_mcp/tools/hello_world.rb
|
|
129
|
+
- lib/kairos_mcp/tools/instructions_update.rb
|
|
129
130
|
- lib/kairos_mcp/tools/knowledge_get.rb
|
|
130
131
|
- lib/kairos_mcp/tools/knowledge_list.rb
|
|
131
132
|
- lib/kairos_mcp/tools/knowledge_update.rb
|
|
@@ -180,6 +181,7 @@ files:
|
|
|
180
181
|
- templates/skills/config.yml
|
|
181
182
|
- templates/skills/kairos.md
|
|
182
183
|
- templates/skills/kairos.rb
|
|
184
|
+
- templates/skills/kairos_quickguide.md
|
|
183
185
|
- templates/skills/versions/.gitkeep
|
|
184
186
|
- templates/skillsets/hestia/config/hestia.yml
|
|
185
187
|
- templates/skillsets/hestia/knowledge/hestia_meeting_place/hestia_meeting_place.md
|
|
@@ -242,7 +244,7 @@ metadata:
|
|
|
242
244
|
homepage_uri: https://github.com/masaomi/KairosChain_2026
|
|
243
245
|
source_code_uri: https://github.com/masaomi/KairosChain_2026
|
|
244
246
|
changelog_uri: https://github.com/masaomi/KairosChain_2026/blob/main/CHANGELOG.md
|
|
245
|
-
post_install_message:
|
|
247
|
+
post_install_message:
|
|
246
248
|
rdoc_options: []
|
|
247
249
|
require_paths:
|
|
248
250
|
- lib
|
|
@@ -257,8 +259,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
257
259
|
- !ruby/object:Gem::Version
|
|
258
260
|
version: '0'
|
|
259
261
|
requirements: []
|
|
260
|
-
rubygems_version: 3.3.
|
|
261
|
-
signing_key:
|
|
262
|
+
rubygems_version: 3.3.26
|
|
263
|
+
signing_key:
|
|
262
264
|
specification_version: 4
|
|
263
265
|
summary: KairosChain - Memory-driven agent framework with blockchain auditability
|
|
264
266
|
test_files: []
|