Skip to content

Feat: show info on loaded instructions in tool metadata info#2

Open
webbugt wants to merge 6 commits intoekroon:mainfrom
webbugt:main
Open

Feat: show info on loaded instructions in tool metadata info#2
webbugt wants to merge 6 commits intoekroon:mainfrom
webbugt:main

Conversation

@webbugt
Copy link
Copy Markdown

@webbugt webbugt commented Feb 13, 2026

Hello, love the plugin. I consider the scoped instructions the Copilot way far superior to the regular AGENTS.md, or other global instruction systems, especially in monorepo setups.

Tldr: Add additional info on which instructions were loaded:

read some typescript and test files so I can confirm tool output
→ Read . 
→ Read src 
→ Read src/index.ts 
↳ Loaded copilot-instructions.md (47 tokens)
↳ Loaded typescript.instructions.md (38 tokens)
↳ Loaded Total: 2 instructions active (85 tokens, <0.1% of context)
→ Read src/frontmatter.ts 
→ Read src/matcher.ts 
→ Read src/loader.ts 
→ Read src/frontmatter.test.ts 
↳ Loaded test.instructions.md (34 tokens)
↳ Loaded Total: 3 instructions active (119 tokens, <0.1% of context)
→ Read src/index.test.ts 
  • updates plugin and dependencies to latest opencode-ai versions
  • implements js-tiktoken for token estimate (should be 95% accurate)
  • shows injected instructions after tool call (maybe move this before for Copilot-like experience)
  • shows relative size of instructions to current model's context size (great for debugging overbloated instructions)

Replace tool title modification (not rendered by TUI for built-in tools)
with a summary entry appended to metadata.loaded array. The summary
includes both repo-wide and path-specific instructions in the total count.

Also upgrades @opencode-ai/plugin and @opencode-ai/sdk to v1.1.65,
fixing breaking type changes (model required on system.transform,
args required on tool.execute.after).
Copilot AI review requested due to automatic review settings February 13, 2026 16:12
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds visibility into which instruction files are loaded by displaying them in tool metadata. When path-specific instructions are injected during file operations (read, edit, write), the plugin now populates the metadata.loaded array with the paths of loaded instruction files and a summary count.

Changes:

  • Modified SessionState to track both instruction text and loaded file paths for each pending tool call
  • Updated tool.execute.after hook to populate output.metadata.loaded with instruction file paths and a total count summary
  • Upgraded @opencode-ai/plugin and @opencode-ai/sdk dependencies from 1.1.3 to 1.1.65

Reviewed changes

Copilot reviewed 6 out of 7 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
src/session-state.ts Changed pending instructions data structure from Map<string, string> to Map<string, { text: string; loadedFiles: string[] }> to track loaded file paths alongside instruction text
src/session-state.test.ts Added comprehensive tests for the new loadedFiles tracking in pending instructions
src/integration.test.ts Added tui.showToast mock to support updated SDK requirements
src/index.ts Modified tool.execute.after to populate metadata.loaded with instruction file paths and summary count; added empty line for formatting
src/index.test.ts Added extensive test coverage for metadata population, including singular/plural counts, preservation of existing entries, and repo-wide instruction counting; added model property to test inputs for SDK compatibility
package.json Updated SDK dependencies to version 1.1.65
package-lock.json Updated lock file with new dependency versions and removed peer: true markers

webbugt and others added 5 commits February 13, 2026 17:18
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 9 out of 10 changed files in this pull request and generated no new comments.

@webbugt
Copy link
Copy Markdown
Author

webbugt commented Feb 23, 2026

@ekroon Hello, any chance this get's merged/reviewed? :3
I have another improvement that I've made, tl:dr; an agent for optimizing instructions

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants