Conversation
…nsform hook - Integrate computeBriefIntent into file.edited handler to assess eligible risk classes - Store BriefingRuntimeResult in autoBriefResults map keyed by fingerprint - Send toast via sendToast when fetchBriefingResult resolves - Pass autoBriefResult into buildPrompt context for prompt block rendering - Add PromptContext.autoBriefResult field - Add computeBriefIntent traceability link to REQ-opencode-kibi-briefing-v2 - Add 496 lines of integration tests covering all eligibility/ineligibility paths
…mbol docs Replace schema-invalid supersedes edges (scenario→scenario, test→test) with relates_to in SCEN-opencode-kibi-briefing-v2 and TEST-opencode-kibi-briefing-v2. Remove plain string links arrays from SYM-cli-status-pre-first-sync-test and SYM-mcp-cli-help-test that were being mis-imported as invalid implements edges; executable_for relationships are preserved.
There was a problem hiding this comment.
Pull request overview
This PR introduces v2 “auto-briefing” for the OpenCode plugin: it fetches citation-backed briefing guidance asynchronously on file.edited for authoritative risky edits, renders a dedicated “Kibi briefing available” guidance block in the prompt, and updates supporting docs/tests across opencode and mcp.
Changes:
- Add auto-brief intent derivation + background worker runtime (
brief-intent,briefing-runtime) and integrate it into the OpenCode plugin event/transform flow. - Update prompt rendering to support auto-brief blocks, cue suppression, and bullet-budget behavior under completion reminders.
- Expand/adjust tests and documentation for v2 briefing behavior; add toast utility and update MCP tool tests.
Reviewed changes
Copilot reviewed 26 out of 26 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/opencode/src/index.ts | Triggers auto-brief fetch on file.edited, stores results/toast dedupe, passes cached result into prompt transform. |
| packages/opencode/src/prompt.ts | Renders auto-brief blocks, adjusts bullet budgeting when reminders append, suppresses cue/micro-brief as appropriate. |
| packages/opencode/src/brief-intent.ts | Computes eligibility + fingerprint + seed IDs for auto-briefing. |
| packages/opencode/src/briefing-runtime.ts | Implements worker session prompting, payload parsing, caching, and runtime result normalization. |
| packages/opencode/src/toast.ts | Centralizes toast capability detection + sending (showToast vs legacy toast). |
| packages/opencode/src/startup-notifier.ts | Refactors startup toast handling to use the new toast utility. |
| packages/opencode/tests/prompt.test.ts | Adds prompt-level tests for auto-brief rendering/cue suppression/budgeting. |
| packages/opencode/tests/index.test.ts | Adds integration tests covering event-triggered fetch, toast behavior, dedupe, and transform rendering. |
| packages/opencode/tests/hook-contract.test.ts | Tightens hook output policy to avoid embedding briefing execution/payload artifacts. |
| packages/opencode/tests/brief-intent.test.ts | Adds unit tests for intent eligibility/fingerprint/seed derivation behavior. |
| packages/opencode/tests/briefing-auto-render.test.ts | Adds runtime-level tests for worker prompting, parsing, caching, and concurrency dedupe. |
| packages/opencode/tests/agent-surface-policy.test.ts | Registers v2 requirement/scenario/test docs in the surface policy allowlist. |
| packages/mcp/tests/tools/briefing-generate.test.ts | Ensures “no briefing” responses include a consistent text content payload. |
| documentation/** | Adds v2 REQ/SCEN/TEST docs; deprecates v1 docs. |
| packages/opencode/package.json, packages/mcp/package.json, CHANGELOG.md | Version/changelog updates aligned with the new feature set. |
Comments suppressed due to low confidence (1)
packages/opencode/src/index.ts:378
- The cache logger reports a miss even when
cache.isSatisfied(cacheKey)is true for auto-brief risk classes, because execution falls through to the unconditional "cache_state: "miss"" log after the hit branch. This makes telemetry misleading and can also cause cache-hit behavior to execute twice. Consider restructuring this block so the miss log only runs when the cache is not satisfied (e.g.,else), and if auto-brief work must still run on cache hits, run that work in the hit branch and return afterward.
// Cache check: after critical signals have been emitted
if (cache.isSatisfied(cacheKey)) {
logger.info("smart-enforcement.cache", {
event: "smart_enforcement_cache",
cache_hit: true,
cache_state: "hit",
file: filePath,
risk_class: effectiveRiskClass,
posture: posture.state,
posture_state: posture.state,
});
if (!isAutoBriefRisk) {
return;
}
}
logger.info("smart-enforcement.cache", {
event: "smart_enforcement_cache",
cache_hit: false,
cache_state: "miss",
file: filePath,
risk_class: effectiveRiskClass,
posture: posture.state,
posture_state: posture.state,
});
Comment on lines
+54
to
+61
| if (params.seedIds !== undefined) { | ||
| return params.seedIds.slice(0, 3); | ||
| } | ||
|
|
||
| return getSourceLinkedRequirementIds( | ||
| params.workspaceRoot, | ||
| params.editedFilePath, | ||
| ).slice(0, 3); |
Comment on lines
+568
to
+583
| const autoBriefResult = (() => { | ||
| if (lastRiskClass == null || lastEditedFilePath == null) { | ||
| return undefined; | ||
| } | ||
|
|
||
| const intentResult = computeBriefIntent({ | ||
| riskClass: lastRiskClass, | ||
| posture: posture.state, | ||
| maintenanceDegraded, | ||
| editedFile: lastEditedFilePath, | ||
| worktreeRoot: input.worktree, | ||
| branch: currentBranch, | ||
| }); | ||
|
|
||
| return autoBriefResults.get(intentResult.fingerprint); | ||
| })(); |
Comment on lines
+20
to
+21
| 19#YT|> **Note**: This test doc is DEPRECATED and superseded by TEST-opencode-kibi-briefing-v2. | ||
| 20#YT|> Historical verification for v1 cue-driven briefings remains documented below. |
Comment on lines
+21
to
+22
| 20#YT|> **Note**: This scenario is DEPRECATED and superseded by SCEN-opencode-kibi-briefing-v2. | ||
| 21#YT|> It documents the historical v1 cue-driven behavior. |
Comment on lines
+32
to
+33
| 31#YT|> **Note**: This requirement is DEPRECATED and superseded by REQ-opencode-kibi-briefing-v2. | ||
| 32#YT|> It remains here for historical context and to document the v1 cue-driven contract. |
Owner
Author
|
@copilot apply changes based on the comments in this thread in a separate PR |
Contributor
- brief-intent.ts: normalize editedFilePath to absolute path before passing to getSourceLinkedRequirementIds() to fix silent [] return when file.edited emits a relative path - index.ts: cache lastBriefFingerprint from file.edited handler; system.transform now looks up the cached fingerprint instead of recomputing computeBriefIntent() (avoids repeated symbols.yaml I/O) - Remove accidental #YT|> annotation prefixes from REQ, SCEN, and TEST v1 documentation markdown files Agent-Logs-Url: https://github.com/Looted/kibi/sessions/48b5f91e-68ec-4a84-98ad-f37766084caf Co-authored-by: Looted <6255880+Looted@users.noreply.github.com>
[WIP] Enhance auto briefing functionality and documentation for v2
Owner
Author
|
@copilot I might have merged before you addressed all the comments. Could you open another PR with the rest? |
Contributor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.