Skip to content

feat: caller-specific context template overrides#35

Closed
bilersan wants to merge 1 commit intoActiveMemory:mainfrom
bilersan:feat/caller-overrides
Closed

feat: caller-specific context template overrides#35
bilersan wants to merge 1 commit intoActiveMemory:mainfrom
bilersan:feat/caller-overrides

Conversation

@bilersan
Copy link
Contributor

@bilersan bilersan commented Mar 7, 2026

Summary

Fixes #34 — Adds caller-specific template overrides to ctx init.

How It Works

ctx init --caller vscode

When --caller is set, TemplateForCaller(name, caller) checks for overrides/<caller>/<template>.md before falling back to the default template in context/. If no override exists for a given template, the default is used — fully backward compatible.

Changes

File Change
internal/assets/embed.go Add TemplateForCaller() function, update embed pattern to include overrides/*/*.md
internal/assets/overrides/vscode/AGENT_PLAYBOOK.md VS Code-specific agent playbook (268 lines)
internal/cli/initialize/cmd/root/run.go Accept caller parameter, use TemplateForCaller instead of Template
internal/cli/initialize/init.go Add --caller flag

VS Code Override

The vscode/AGENT_PLAYBOOK.md provides VS Code-optimized guidance:

  • Workspace API patterns and file system conventions
  • Extension lifecycle and activation events
  • Copilot Chat participant conventions
  • VS Code-specific debugging workflows
  • Webview and TreeView patterns

Testing

go build ./...     ✅
go test ./internal/assets/...          ✅
go test ./internal/cli/initialize/...  ✅
ctx init --help    ✅ (shows --caller flag)

@bilersan bilersan requested a review from josealekhine as a code owner March 7, 2026 02:54
Add a --caller flag to 'ctx init' that lets calling tools (e.g. VS Code
extension) identify themselves so ctx can emit tailored context files.

When --caller is set, TemplateForCaller checks for a caller-specific
override in overrides/<caller>/<template>.md before falling back to the
default template. This allows different AI tools to get optimized
playbooks without changing the core template set.

Includes a VS Code-specific AGENT_PLAYBOOK.md override (268 lines) that
provides VS Code-aware instructions: workspace API patterns, extension
lifecycle, Copilot Chat participant conventions, and VS Code-specific
debugging workflows.

Changes:
- internal/assets/embed.go: add TemplateForCaller() + embed overrides
- internal/assets/overrides/vscode/AGENT_PLAYBOOK.md: VS Code playbook
- internal/cli/initialize/cmd/root/run.go: accept caller, use override
- internal/cli/initialize/init.go: add --caller flag

Signed-off-by: ersan bilik <ersanbilik@gmail.com>
@bilersan bilersan force-pushed the feat/caller-overrides branch from 49bdd62 to db15c88 Compare March 7, 2026 02:59
@bilersan
Copy link
Contributor Author

bilersan commented Mar 7, 2026

Superseded by consolidated VS Code extension PR — caller overrides included.

@bilersan bilersan closed this Mar 7, 2026
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.

Caller-specific context template overrides for ctx init

1 participant