kibi-opencode 0.5.0 → 0.5.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.
- package/README.md +9 -9
- package/dist/prompt.js +12 -7
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -29,10 +29,10 @@ The plugin provides context-aware prompt guidance based on recent edits and work
|
|
|
29
29
|
|
|
30
30
|
### Targeted Validation Checks
|
|
31
31
|
|
|
32
|
-
After KB-document edits, the plugin queues targeted
|
|
32
|
+
After KB-document edits, the plugin queues targeted validation rules to run via background sync operations:
|
|
33
33
|
|
|
34
|
-
- **Must-priority requirement edits**:
|
|
35
|
-
- **Other requirement/scenario/test/ADR/fact edits**:
|
|
34
|
+
- **Must-priority requirement edits**: elevated validation including coverage checks
|
|
35
|
+
- **Other requirement/scenario/test/ADR/fact edits**: standard validation for required fields and dangling references
|
|
36
36
|
|
|
37
37
|
The plugin inspects requirement frontmatter to detect `priority: must` and schedules elevated validation for critical requirements. Runs in background after sync completes, non-blocking. Can be disabled via `guidance.targetedChecks.enabled: false`.
|
|
38
38
|
|
|
@@ -42,7 +42,7 @@ When `guidance.warnOnKbEdits` is enabled (default: `true`), manual edits to file
|
|
|
42
42
|
|
|
43
43
|
- Logs warning immediately
|
|
44
44
|
- Injects prompt guidance discouraging manual `.kb` edits
|
|
45
|
-
- Directs agents toward MCP
|
|
45
|
+
- Directs agents toward public MCP tools (`kb_upsert`, `kb_query`, etc.)
|
|
46
46
|
|
|
47
47
|
### Session Tracking and Pattern Detection
|
|
48
48
|
|
|
@@ -96,9 +96,9 @@ The plugin injects guidance into OpenCode sessions to improve agent grounding. U
|
|
|
96
96
|
|
|
97
97
|
OpenCode exposes Kibi MCP prompts as slash commands. The `/init-kibi` command runs the retroactive bootstrap workflow using only public MCP tools.
|
|
98
98
|
|
|
99
|
-
###
|
|
99
|
+
### Background Sync Operations
|
|
100
100
|
|
|
101
|
-
|
|
101
|
+
Internal maintenance automatically syncs the knowledge base after relevant file edits:
|
|
102
102
|
|
|
103
103
|
- Single-flight scheduler (no overlapping syncs)
|
|
104
104
|
- Debounce window (default: 2000ms)
|
|
@@ -183,10 +183,10 @@ This repository's OpenCode setup dogfoods local built artifacts. `opencode.json`
|
|
|
183
183
|
|
|
184
184
|
## Architecture
|
|
185
185
|
|
|
186
|
-
This is a thin bridge layer:
|
|
186
|
+
This is a thin bridge layer per ADR-016:
|
|
187
187
|
|
|
188
|
-
-
|
|
189
|
-
-
|
|
188
|
+
- **Agent-visible guidance**: Public MCP tools (`kb_query`, `kb_upsert`, `kb_check`, etc.) and sanctioned slash commands (`/init-kibi`)
|
|
189
|
+
- **Internal maintenance**: Background sync operations handle KB synchronization; agents do NOT run sync commands directly
|
|
190
190
|
- Does NOT own KB storage, parsing, or validation
|
|
191
191
|
|
|
192
192
|
### Future: File-Context Virtual Injection
|
package/dist/prompt.js
CHANGED
|
@@ -3,14 +3,14 @@ const SENTINEL = "<!-- kibi-opencode -->";
|
|
|
3
3
|
/**
|
|
4
4
|
* Build prompt guidance block based on path kind.
|
|
5
5
|
*/
|
|
6
|
-
// implements REQ-opencode-kibi-plugin-v1
|
|
6
|
+
// implements REQ-opencode-kibi-plugin-v1, REQ-opencode-agent-mcp-only
|
|
7
7
|
function buildContextualGuidance(context) {
|
|
8
8
|
const parts = [SENTINEL];
|
|
9
9
|
if (context.hasRecentKbEdit) {
|
|
10
10
|
parts.push(`
|
|
11
11
|
⚠️ **WARNING: Do not edit .kb/** files manually.**
|
|
12
12
|
|
|
13
|
-
The Kibi knowledge base is managed through MCP and
|
|
13
|
+
The Kibi knowledge base is managed through public MCP tools and internal maintenance flows. Direct manual edits to files under .kb/** can cause inconsistencies and should be avoided.
|
|
14
14
|
|
|
15
15
|
Instead:
|
|
16
16
|
- Use kb_upsert to create/update entities
|
|
@@ -22,10 +22,11 @@ Instead:
|
|
|
22
22
|
parts.push(`
|
|
23
23
|
🔧 **Bootstrap required**
|
|
24
24
|
|
|
25
|
-
This repository does not appear to have Kibi initialized.
|
|
26
|
-
- \`/init-kibi\` for retroactive bootstrap of existing repos
|
|
27
|
-
-
|
|
28
|
-
|
|
25
|
+
This repository does not appear to have Kibi initialized. Agents should:
|
|
26
|
+
- Use \`/init-kibi\` for retroactive bootstrap of existing repos (preferred MCP command)
|
|
27
|
+
- Ask the user/operator to run setup or repair outside this session if \`/init-kibi\` is insufficient
|
|
28
|
+
|
|
29
|
+
Do not run \`kibi\` CLI commands directly; use the MCP tools (kb_query, kb_upsert, kb_delete, kb_check).
|
|
29
30
|
`);
|
|
30
31
|
}
|
|
31
32
|
const codeEdits = context.recentEdits.filter((e) => e.kind === "code");
|
|
@@ -121,7 +122,7 @@ Preferred structure:
|
|
|
121
122
|
|
|
122
123
|
When editing KB documentation:
|
|
123
124
|
1. **Maintain traceability** - Link entities using relationships: specified_by (req→scenario), verified_by (req→test), etc.
|
|
124
|
-
2. **Validate** -
|
|
125
|
+
2. **Validate** - Use \`kb_check\` after making changes to catch integrity issues.
|
|
125
126
|
3. **Follow entity patterns** - Ensure each entity has proper frontmatter with required fields.
|
|
126
127
|
`);
|
|
127
128
|
}
|
|
@@ -144,6 +145,8 @@ Dogfood note for this repo: OpenCode here uses local built \`kibi-mcp\` and \`ki
|
|
|
144
145
|
|
|
145
146
|
**Public Kibi tools only:** kb_query, kb_upsert, kb_delete, kb_check.
|
|
146
147
|
|
|
148
|
+
Do not invoke Kibi CLI commands directly from the agent.
|
|
149
|
+
|
|
147
150
|
Bootstrap existing repos: use \`/init-kibi\` to run the retroactive initialization workflow.`);
|
|
148
151
|
}
|
|
149
152
|
return parts.join("\n\n").trim();
|
|
@@ -170,6 +173,8 @@ Dogfood note for this repo: OpenCode here uses local built \`kibi-mcp\` and \`ki
|
|
|
170
173
|
|
|
171
174
|
**Public Kibi tools only:** kb_query, kb_upsert, kb_delete, kb_check.
|
|
172
175
|
|
|
176
|
+
Do not invoke Kibi CLI commands directly from the agent.
|
|
177
|
+
|
|
173
178
|
Bootstrap existing repos: use \`/init-kibi\` to run the retroactive initialization workflow.`;
|
|
174
179
|
/**
|
|
175
180
|
* Build prompt with contextual guidance based on recent edits and workspace state.
|