beans-vscode
Copilot instructions2 starsChanged 10 months agoMITView on GitHub
A VS Code extension for the Beans issue tracker. It wraps the beans CLI, provides sidebar tree views, webview details/search panels, an MCP server, and a @beans chat participant. esbuild.js is the bundler config. It uses loader: { '.md': 'text' } to inline Markdown template files as string constants — used for Copilot instructions/skill templates in src/beans/config/templates/. Process execution — never build shell strings. BeansService always calls beans via an argument array with child_process.execFile or similar. Treat all bean content…
The file
Show its rules and text
We split this copilot-instructions.md into the rules it gives an agent
26 rules. About 0 are common, 17 are distinctive, and 9 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈17
Distinctive · estimate
This author's own choices. Worth a look.
9
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 69
When tracking your own work with Beans in this repository:
- Distinctive: line 78
When writing tests or verifying extension functionality:
- Distinctive: line 114
No shell-interpolated strings anywhere in CLI invocation.
- Very specific: line 133
Never start work without a bean: Before writing any code or making any change, find a relevant existing bean or create a new one.
- Distinctive: line 140
Commit a bean immediately after creating or modifying it — unless you are creating a milestone/epic and are about to create its child …
- Distinctive: line 144
If the issue does not already have a branch, create one when you begin work.
- Distinctive: line 145
If you are resuming work, checkout the existing branch for that issue first.
- Distinctive: line 157
Commit this update immediately.
- Distinctive: line 168
If the bean already has an existing branch, checkout that branch.
- Very specific: line 172
All progress, subtasks and checkboxes belong in the bean's ## Todo checklist in the bean body.
- Very specific: line 176
Always use the MCP or extension commands to create or edit beans.
- Distinctive: line 196
When AI features are enabled, the extension maintains:
- Distinctive: line 201
Use these as authoritative guidance for Beans workflows in this repository.
- Very specific: line 205
Before any work: search for a relevant bean using beans.search or @beans /search.
- Distinctive: line 206
Create or checkout the issue branch: before coding.
- Very specific: line 207
If starting new issue work, create a branch using [type]/[issue-number-without-prefix]-[short-title].
- Distinctive: line 208
If resuming, checkout the issue's existing branch.
- Very specific: line 251
Mutate only with explicit intent: create, edit, set status/type/priority, manage relationships.
- Distinctive: line 257
When planning an epic:
- Distinctive: line 262
Ask for approval before creating any issues.
- Distinctive: line 263
Create all approved child issues and link them with parent relationships.
- Distinctive: line 267
Use compact planning checklist format:
- Very specific: line 273
Always run beans prime before doing anything in the CLI.
- Very specific: line 274
Always use --json for output.
- Very specific: line 275
Never pass large blocks of body text directly as a shell argument.
- Distinctive: line 276
Run one operation at a time.
≈ “Common” is an estimate: at least 1 in 5 of the 1,644 Copilot instructions files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
GitHub Copilot Instructions for beans-vscode
What this is
A VS Code extension for the Beans issue tracker. It wraps the beans CLI, provides sidebar tree views, webview details/search panels, an MCP server, and a @beans chat participant.
Build & test
pnpm run compile # esbuild bundle + tsc type-check (one-shot)
pnpm run watch:esbuild # incremental bundle (dev)
pnpm run watch:tsc # incremental type-check (dev)
pnpm run test # Vitest (vscode API mocked)
pnpm run lint # ESLintesbuild.js is the bundler config. It uses loader: { '.md': 'text' } to inline Markdown template files as string constants — used for Copilot instructions/skill templates in src/beans/config/templates/.
Module map
| Module | Purpose |
src/extension.ts | Activation: wires all providers, registers disposables |
src/beans/service/BeansService.ts | Typed CLI wrapper — all beans invocations go through here as argument arrays |
src/beans/tree/BeansTreeDataProvider.ts | Base tree provider; status-specific subclasses in tree/providers/ |
src/beans/tree/registerBeansTreeViews.ts | Registers all five pane tree views (active/completed/draft/scrapped/archived) |
src/beans/commands/BeansCommands.ts | All command registration and orchestration |
src/beans/details/BeansDetailsViewProvider.ts | Webview sidebar — bean detail view + inline metadata selects |
src/beans/search/BeansSearchViewProvider.ts | Webview search panel |
src/beans/mcp/BeansMcpIntegration.ts | Stdio MCP server lifecycle; port from beans.mcp.port (default 39173) |
src/beans/chat/BeansChatIntegration.ts | @beans chat participant + slash commands |
src/beans/config/BeansConfigManager.ts | Reads/writes .beans.yml, generates .github/instructions/tasks.instructions.md and .github/skills/beans/SKILL.md |
src/beans/config/templates/ | Markdown templates for generated Copilot artifacts; {{GRAPHQL_SCHEMA}} placeholder replaced at write time |
src/beans/model/ | Bean type, errors.ts typed error classes, config.ts workspace config types |
Key patterns
Process execution — never build shell strings. BeansService always calls beans via an argument array with child_process.execFile or similar. Treat all bean content as untrusted input.
Codicons in webviews — @vscode/codicons ships a @font-face with a relative URL that fails in vscode-webview: context. Always add an explicit override at the top of inline <style>:
<style>
@font-face { font-family:"codicon"; src:url("${codiconFontUri}") format("truetype"); }where codiconFontUri = webview.asWebviewUri(Uri.joinPath(extensionUri, 'dist', 'media', 'codicon.ttf')).
Note:
node_modules/**is excluded from the VSIX. The build step (scripts/copy-codicons.js) copiescodicon.ttfandcodicon.cssintodist/media/so they are packaged and available at runtime. Never referencenode_modules/@vscode/codicons/…paths in webview URIs.
Priority labels — use circled Unicode characters ①②③④⑤ (not codicons) for priority in all UI surfaces (tree item labels, quick picks, webview selects).
Context keys — dynamic UI state (e.g. navigation back-button visibility) uses the pattern: expose a getter → call executeCommand('setContext', 'beans.<key>', value) → reference in package.json when clauses. See BeansDetailsViewProvider.updateDetailsContextKeys.
Tree providers — each status pane is a subclass of BeansTreeDataProvider with a fixed statusFilter. Shared sort/filter/refresh logic lives in the base class. Registered and disposed in registerBeansTreeViews.ts.
Markdown templates — CopilotInstructions.ts and CopilotSkill.ts import from .md template files (inlined by esbuild). Use {{GRAPHQL_SCHEMA}} as the sole placeholder; no complex interpolation in TS.
Testing
vitest.config.ts aliases vscode → src/test/mocks/vscode.ts. Tests live under src/test/. Do not import vscode directly in tests — use the mock.
Tool usage priority
Always prefer extension commands and MCP tools over CLIs. The priority depends on context:
For Beans work tracking (using this extension)
When tracking your own work with Beans in this repository:
- VS Code extension commands/UI first — use command palette, sidebar, or webviews (
beans.create,beans.edit,beans.setStatus, etc.). Best user experience. - @beans chat participant second — conversational interface for guidance, summaries, and workflows.
- MCP tools third — programmatic interface when integrated into automated workflows.
- CLI last resort only — via
BeansServiceargument arrays; never shell strings.
For testing extension code
When writing tests or verifying extension functionality:
- MCP tools first — programmatic, deterministic testing of Beans operations.
- Extension commands second — for UI/UX verification and integration testing.
- Direct TypeScript calls third — when testing internal APIs (
BeansService, etc.). - CLI last resort only — via
BeansServiceargument arrays; never shell strings.
Both contexts: never build shell command strings; always use BeansService with argument arrays when CLI invocation is unavoidable.
Key patterns
Process execution — never build shell strings. BeansService always calls beans via an argument array with child_process.execFile or similar. Treat all bean content as untrusted input.
Codicons in webviews — @vscode/codicons ships a @font-face with a relative URL that fails in vscode-webview: context. Always add an explicit override at the top of inline <style>:
<style>
@font-face { font-family:"codicon"; src:url("${codiconFontUri}") format("truetype"); }where codiconFontUri = webview.asWebviewUri(Uri.joinPath(extensionUri, 'node_modules', '@vscode', 'codicons', 'dist', 'codicon.ttf')).
Priority labels — use circled Unicode characters ①②③④⑤ (not codicons) for priority in all UI surfaces (tree item labels, quick picks, webview selects).
Context keys — dynamic UI state (e.g. navigation back-button visibility) uses the pattern: expose a getter → call executeCommand('setContext', 'beans.<key>', value) → reference in package.json when clauses. See BeansDetailsViewProvider.updateDetailsContextKeys.
Tree providers — each status pane is a subclass of BeansTreeDataProvider with a fixed statusFilter. Shared sort/filter/refresh logic lives in the base class. Registered and disposed in registerBeansTreeViews.ts.
Markdown templates — CopilotInstructions.ts and CopilotSkill.ts import from .md template files (inlined by esbuild). Use {{GRAPHQL_SCHEMA}} as the sole placeholder; no complex interpolation in TS.
Testing
vitest.config.ts aliases vscode → src/test/mocks/vscode.ts. Tests live under src/test/. Do not import vscode directly in tests — use the mock.
Security constraints
- No shell-interpolated strings anywhere in CLI invocation.
- CSP in all webviews:
default-src 'none'; explicitly allowlistfont-src ${webview.cspSource}andimg-src ${webview.cspSource} data:. localResourceRoots: [extensionUri]on all webviews.
Definition of done
A change is complete when: command wired in package.json + BeansCommands.ts, errors surface via BeansOutput logger, unit test added/updated, and compile passes.
title: Beans Task Management Rules description: Generated Copilot instructions for Beans workflows in this workspace.
Beans Task Management Rules
<CRITICALLY_IMPORTANT>
- Never start work without a bean. Before writing any code or making any change, find a relevant existing bean or create a new one. Set its status to
in-progress. There are no exceptions. - Always use the extension or MCP first. Invoke Beans operations through the VS Code extension commands or MCP tools. Use the
@beanschat participant for guidance. Fall back to the CLI only when the extension, chat, and MCP are genuinely unavailable — and even then, read the constraints below. - Track all work in the bean's body. Maintain a
## Todochecklist in the bean body. After each completed step, mark the item done and sync the bean. Never use TodoWrite, editor scratch pads, or ad-hoc lists. - Commit beans promptly.
- Commit a bean immediately after creating or modifying it — unless you are creating a milestone/epic and are about to create its child beans, in which case commit everything together once the hierarchy is complete.
- Completed todo items may be committed together with the code changes they relate to.
- Start or resume on the correct issue branch before writing code.
- If the issue does not already have a branch, create one when you begin work.
- If you are resuming work, checkout the existing branch for that issue first.
- Branch names must follow:
[type]/[issue-number-without-prefix]-[short-title]. - Examples:
feat/1234-add-search,fix/987-crash-on-init. - Push the branch and record it in the bean frontmatter as soon as it exists.
Record the branch and PR in the bean. As soon as a branch or PR exists, add it to the bean's YAML frontmatter:
branch: feature/<bean-id>-<slug> pr: <pr-number>Commit this update immediately.
- Closing a bean.
- Completed: add a
## Summary of Changessection, then set status tocompleted. - Scrapped: add a
## Reasons for Scrappingsection, then set status toscrapped.
- Completed: add a
</CRITICALLY_IMPORTANT>
<!-- Agent-specific constraints: enforce by Copilot/skills -->- Agent MUST create or switch to the issue branch before making any edits.
- If the bean already has an existing branch, checkout that branch; otherwise create a new branch and push it immediately.
- Branch names must follow the repository convention and be recorded in the bean frontmatter as shown above.
- Agents must NOT keep a separate internal todo list.
- All progress, subtasks and checkboxes belong in the bean's
## Todochecklist in the bean body. - The agent must update the bean's
## Todovia the MCP or extension APIs and commit the updated bean; never persist task state only in the agent runtime.
- All progress, subtasks and checkboxes belong in the bean's
- Agents must NOT create bean files by writing files directly or adding custom frontmatter fields.
- Always use the MCP or extension commands to create or edit beans. Do not write new
.mdbean files directly in the repository. - The only permitted bean frontmatter keys the agent may set are
branchandpr(PR number). Do not add custom fields beyond these.
- Always use the MCP or extension commands to create or edit beans. Do not write new
Beans Usage Guide for Agents (Extension-First)
This file is generated by the Beans VS Code extension and defines the preferred execution model.
Interface priority (highest → lowest)
Always try each level in order. Only descend when the level above is genuinely unavailable.
- Beans VS Code extension commands/UI ← start here every time
- Beans chat participant (
@beans) and slash commands - Beans MCP tools
- Beans CLI ← last resort only; see constraints below
The CLI is a fallback for environments where the extension, chat participant, and MCP are all inaccessible. Do not prefer it for convenience.
Generated artifact context
When AI features are enabled, the extension maintains:
.github/instructions/tasks.instructions.md.github/skills/beans/SKILL.md
Use these as authoritative guidance for Beans workflows in this repository.
Core Beans workflow
- Before any work: search for a relevant bean using
beans.searchor@beans /search. If none fits, create one withbeans.createand set it toin-progress. - Create or checkout the issue branch before coding.
- If starting new issue work, create a branch using
[type]/[issue-number-without-prefix]-[short-title]. - If resuming, checkout the issue's existing branch.
- Examples:
feat/1234-add-search,fix/987-crash-on-init.
- If starting new issue work, create a branch using
- Push branch and add branch/PR to bean frontmatter as soon as they exist. Commit the bean update.
- Maintain a
## Todochecklist in the bean body. Update it after every completed step and commit the updated bean (alone or together with related code changes). - On completion, add
## Summary of Changes, set status tocompleted, and commit the final bean state. - On scrap, add
## Reasons for Scrapping, set status toscrapped, and commit.
Extension commands (preferred)
Bean operations:
beans.create,beans.view,beans.edit,beans.delete(draft/scrapped only)beans.setStatus,beans.setType,beans.setPrioritybeans.setParent,beans.removeParent,beans.editBlockingbeans.reopenCompleted,beans.reopenScrappedbeans.copyId
Search and navigation:
beans.search,beans.filter,beans.sort,beans.refreshbeans.searchView.filter(filter search results),beans.searchView.clear(clear search)beans.details.back(navigate back in Details view history)
AI and workflow:
beans.copilotStartWork— open Copilot Chat with a workflow template (assess status, remaining steps, close/commit, export to GitHub issue, set in-progress, flesh out specs)
Configuration and help:
beans.init,beans.openConfig,beans.openExtensionSettingsbeans.showOutput,beans.openUserGuide,beans.openAiFeaturesGuidebeans.openFirstMalformedBean(navigate to malformed bean files)
Chat workflows (@beans)
/summary— status overview/priority— top-priority active issues/stale— stale issues by age/create— issue creation guidance/next— suggest the next bean to start/search— issue search
- Read/context first:
beans_querywithoperation: "llm_context", then view/search/filter/sort as needed. - Mutate only with explicit intent: create, edit, set status/type/priority, manage relationships.
- Destructive actions (delete, archive) require explicit user confirmation unless the user already requested it.
- MCP is the preferred programmatic interface when the extension UI is not in focus.
Planning mode for epic decomposition
When planning an epic:
- Confirm goal, constraints, and definition of done.
- Propose a child-issue map grouped by outcomes.
- For each child issue, include title, type, priority, and dependencies.
- Ask for approval before creating any issues.
- Create all approved child issues and link them with parent relationships.
- Commit the parent epic and all child beans together once the hierarchy is complete.
- Return created IDs and suggest the first issue to start.
Use compact planning checklist format:
<title>— type=<type>, priority=<priority>, depends_on=<ids|none>
Constraints when using the CLI:
- Always run
beans primebefore doing anything in the CLI. - Always use
--jsonfor output; never parse plain-text output. - Never pass large blocks of body text directly as a shell argument; use GraphQL variables or pipe the query into
beans graphql. - Run one operation at a time; do not chain destructive commands.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

