name: ai-context-extension-host
description: Guides the ai-context-writer subagent in generating and maintaining AI_CONTEXT_EXTENSION_HOST.md, documenting the VS Code extension host architecture, command registration, Python service lifecycle, message handling, auto-refresh, and error/retry behavior for the python-vis project. Use when creating or updating the extension host AI context file.
AI Context Extension Host Skill
Purpose
Help the ai-context-writer subagent create and maintain docs/AI_CONTEXT/AI_CONTEXT_EXTENSION_HOST.md as the component-level reference for the src/ VS Code extension host:
- How the extension activates and deactivates
- How commands are registered
- How the Python service is spawned and managed
- How messages are exchanged with the webview
- How auto-refresh and error handling work
Sources to Read
Before updating the extension host context, read:
@src/extension.ts
@src/pythonClient.ts
@src/types.ts
@src/conversion.ts
- Relevant tests targeting extension behavior (if present)
@docs/AI_CONTEXT/AI_CONTEXT_REPOSITORY.md for overall architecture
Use these files as ground truth for actual behavior.
Required Sections in AI_CONTEXT_EXTENSION_HOST.md
Include at least:
Metadata
- Version
- Last Updated (ISO date)
- Tags including
extension-host, vscode, integration
- Cross-References to repository, quick reference, and webview UI AI_CONTEXT docs
Module Overview
- Responsibilities of:
extension.ts
pythonClient.ts
types.ts
conversion.ts
Activation & Deactivation
- How
activate(context):
- Instantiates
PythonClient
- Registers the
python-ast.visualize command
- Subscribes to
workspace.onDidSaveTextDocument for auto-refresh
- How
deactivate() cleans up processes and resources.
PythonClient Lifecycle (pythonClient.ts)
spawnService() and how it starts python -m python_service.
parseAST(sourceCode: string) request/response flow.
stopService() and isServiceRunning().
- Error and exit handling.
Message Contracts (types.ts + conversion.ts)
- Types used for:
ReteGraph, ReteNode, ReteConnection, NodeData.
- Messages to the webview (
updateGraph, error, loading).
- Messages from the webview (
navigateToSource, retry).
- Conversion logic between Python graph JSON and TypeScript types.
Visualization Panel Management
- How visualization panels are created and identified (IDs, document URIs).
- How the extension tracks open panels and sends updates to all panels for a document.
Auto-Refresh Flow
onDidSaveTextDocument → handleAutoRefresh.
- Debouncing behavior per document URI.
- Sequence of:
- Sending
"loading" to panels.
- Ensuring Python service is running.
- Calling
parseAST and broadcasting "updateGraph" or "error".
Error Handling & Retry
- How
logError writes to the Output channel.
- How parse or communication failures are surfaced to the user via notifications and webview messages.
- How
"retry" from the webview is handled (re-open document, re-parse).
Extension Points
- Where to add new VS Code commands.
- How to introduce new message types between extension and webview.
- How to adapt PythonClient or the protocol when adding new capabilities.
Style & Constraints
- Focus on behavior and integration points, not generic VS Code extension concepts.
- Use concise, structured sections; avoid long prose.
- Include short code snippets or type definitions when they clarify message shapes or flows.
- Keep the file under the content length limit; split if the extension host grows substantially.
Update Strategy
When the extension host changes:
- Update activation/deactivation behavior and command list.
- Adjust PythonClient lifecycle description and protocol interactions.
- Refresh message contracts and flows to match
types.ts and App.tsx.
- Bump version and last-updated metadata.
Converted and distributed by TomeVault — claim your Tome and manage your conversions.
1---2name: benweatherall-vscode-python-ast-extension-ai-context-extensi3description: ---4---5---6name: ai-context-extension-host7description: Guides the ai-context-writer subagent in generating and maintaining AI_CONTEXT_EXTENSION_HOST.md, documenting the VS Code extension host architecture, command registration, Python service lifecycle, message handling, auto-refresh, and error/retry behavior for the python-vis project. Use when creating or updating the extension host AI context file.8---910# AI Context Extension Host Skill1112## Purpose1314Help the `ai-context-writer` subagent create and maintain `docs/AI_CONTEXT/AI_CONTEXT_EXTENSION_HOST.md` as the **component-level reference** for the `src/` VS Code extension host:1516- How the extension activates and deactivates17- How commands are registered18- How the Python service is spawned and managed19- How messages are exchanged with the webview20- How auto-refresh and error handling work2122## Sources to Read2324Before updating the extension host context, read:2526- `@src/extension.ts`27- `@src/pythonClient.ts`28- `@src/types.ts`29- `@src/conversion.ts`30- Relevant tests targeting extension behavior (if present)31- `@docs/AI_CONTEXT/AI_CONTEXT_REPOSITORY.md` for overall architecture3233Use these files as ground truth for actual behavior.3435## Required Sections in AI_CONTEXT_EXTENSION_HOST.md3637Include at least:38391. **Metadata**40 - Version41 - Last Updated (ISO date)42 - Tags including `extension-host`, `vscode`, `integration`43 - Cross-References to repository, quick reference, and webview UI AI_CONTEXT docs44452. **Module Overview**46 - Responsibilities of:47 - `extension.ts`48 - `pythonClient.ts`49 - `types.ts`50 - `conversion.ts`51523. **Activation & Deactivation**53 - How `activate(context)`:54 - Instantiates `PythonClient`55 - Registers the `python-ast.visualize` command56 - Subscribes to `workspace.onDidSaveTextDocument` for auto-refresh57 - How `deactivate()` cleans up processes and resources.58594. **PythonClient Lifecycle (pythonClient.ts)**60 - `spawnService()` and how it starts `python -m python_service`.61 - `parseAST(sourceCode: string)` request/response flow.62 - `stopService()` and `isServiceRunning()`.63 - Error and exit handling.64655. **Message Contracts (types.ts + conversion.ts)**66 - Types used for:67 - `ReteGraph`, `ReteNode`, `ReteConnection`, `NodeData`.68 - Messages to the webview (`updateGraph`, `error`, `loading`).69 - Messages from the webview (`navigateToSource`, `retry`).70 - Conversion logic between Python graph JSON and TypeScript types.71726. **Visualization Panel Management**73 - How visualization panels are created and identified (IDs, document URIs).74 - How the extension tracks open panels and sends updates to all panels for a document.75767. **Auto-Refresh Flow**77 - `onDidSaveTextDocument` → `handleAutoRefresh`.78 - Debouncing behavior per document URI.79 - Sequence of:80 - Sending `"loading"` to panels.81 - Ensuring Python service is running.82 - Calling `parseAST` and broadcasting `"updateGraph"` or `"error"`.83848. **Error Handling & Retry**85 - How `logError` writes to the Output channel.86 - How parse or communication failures are surfaced to the user via notifications and webview messages.87 - How `"retry"` from the webview is handled (re-open document, re-parse).88899. **Extension Points**90 - Where to add new VS Code commands.91 - How to introduce new message types between extension and webview.92 - How to adapt PythonClient or the protocol when adding new capabilities.9394## Style & Constraints9596- Focus on **behavior and integration points**, not generic VS Code extension concepts.97- Use concise, structured sections; avoid long prose.98- Include short code snippets or type definitions when they clarify message shapes or flows.99- Keep the file under the content length limit; split if the extension host grows substantially.100101## Update Strategy102103When the extension host changes:1041051. Update activation/deactivation behavior and command list.1062. Adjust PythonClient lifecycle description and protocol interactions.1073. Refresh message contracts and flows to match `types.ts` and `App.tsx`.1084. Bump version and last-updated metadata.109110111---112> Converted and distributed by [TomeVault](https://tomevault.io/claim/benweatherall) — claim your Tome and manage your conversions.113<!-- tomevault:4.0:skill_md:2026-04-14 -->