AutoDocSync Usage GuideThis guide explains how to use the AutoDocSync VS Code extension in a repository after the extension has been installed. What the extension expectsThe extension only creates the
and the config contains:
That config file can optionally point to:
The extension validates that each route includes the required guidance:
If Recommended repository layoutUse this structure in the repository that will use the extension:
Sample config file (At a Minumum)Create
Full templateUse this template as a complete starting point for a repo-level configuration. Replace the example agent names with real ones that exist in your Copilot environment.
This tells the extension:
Properties in
|
| Property | Required | Default / Example | Purpose |
|---|---|---|---|
enabled |
Yes, for AutoDocSync to run | true |
Turns AutoDocSync on for this repo. If omitted or false, .copilot is not created and no runs are triggered. |
sourceGlobs |
No, but strongly recommended | ["src/**"] |
Files or folders to watch for changes. Only matching files trigger an autodocsync run. |
excludeGlobs |
No | [] or common build/generated ignores |
Skip files like bin, obj, logs, or temp output. |
defaultAgent |
No | "AutoDocSyncAgent" or repo-specific agent |
Optional fallback agent used when a route or repo default is available. If omitted, the extension falls back to the route instructionFiles. |
configFile |
No | .github/autodocsync.json |
Lets you override the config file location if needed. |
copilotCliPath |
No | "copilot" |
Command or path to the Copilot CLI executable. |
maxRunMinutes |
No | 30 |
Maximum time allowed before a run is force-stopped. |
extraCopilotArgs |
No | ["--allow-all", "--no-ask-user", "--autopilot", "--no-color"] |
Extra CLI args passed to Copilot. |
logDirectory |
No | .copilot/autodocsync |
Folder used for runtime state and logs. |
routes |
Yes, if you want route-based behavior | [] |
Defines which files match which guidance set and which docs should be updated. |
routes[].name |
No | descriptive name | Optional label for debugging and logging. |
routes[].match |
Yes, for each route | e.g. ["src/**"] |
Glob patterns that define which changed files trigger the route. |
routes[].agent |
No | e.g. "ARRAutoDocSync" |
Optional route-level agent name. If omitted, defaultAgent is used when available; otherwise the extension relies on instructionFiles. |
routes[].agentFile |
No | .github/agents/... |
Optional route-level agent guidance file. If present, it is included alongside the instructions. |
routes[].instructionFiles |
Yes | .github/instructions/... |
Required one or more instruction files that guide the model. |
routes[].docRoots |
No, but recommended | ["docs/**"] |
Documentation folders the agent may update. |
routes[].reportFormat |
No | free-form string | Custom last-line format for the summary report. |
Mandatory vs optional summary
Mandatory for AutoDocSync to do anything useful:
enabled: true- at least one route entry in
routeswhen using route-based execution - each route must include
instructionFileswith at least one file matchshould be present on each routeagent,agentFile, anddefaultAgentare optional and only used when provided
Optional but commonly used:
defaultAgentsourceGlobsexcludeGlobsdocRootsreportFormat- custom
logDirectory
Sample agent file
Create .github/agents/autodocsync.agent.md with the agent guidance you want the Copilot CLI to use.
Example:
# AutoDocSync Agent
You are helping keep repository documentation up to date.
- Review changed source files.
- Update only relevant documentation.
- Keep tone and structure consistent with the existing docs.
- Ignore generated files, build output, and test artifacts.
- Return a brief final report with what changed.
Sample instruction file
Create .github/instructions/autodocsync.instructions.md with instructions like:
# AutoDocSync Instructions
Use these instructions as a starting point for documentation updates.
## Goal
Keep repository documentation aligned with source changes.
## Scope
- Read every changed source file before editing documentation.
- Update only documented files under the configured docRoots.
- Do not modify source code or generated outputs.
- Prefer updating existing documentation instead of creating new files.
## Final report
End each run with a short report that includes:
- documents updated
- source files reviewed
- skipped files and reasons
- any documentation gaps needing human review
How the extension behaves
Once installed and enabled:
- it watches for source file changes
- checks whether the changed files match configured route patterns
- loads the repo config from
.github/autodocsync.json - invokes Copilot CLI using the selected route
- updates documentation under the matching
docRoots - writes logs under
.copilot/autodocsync
The .copilot folder is created only when all of the following are true:
- the repo contains
.github/autodocsync.json - the config file exists and is valid JSON
- the config contains
"enabled": true - AutoDocSync has started successfully for the current workspace
If the config is missing, disabled, or the workspace is not trusted, the extension will not create the .copilot state folder.
What is created under .copilot/autodocsync
When AutoDocSync starts successfully, it creates a state folder similar to:
.copilot/
autodocsync/
autodocsync.log
last-source-signature.txt
prompt-<timestamp>.txt
logs/
copilot-<timestamp>.log
Purpose of each file
autodocsync.log- main runtime log from the extension itself
- shows when AutoDocSync started, when files changed, and whether a run was skipped
- helps confirm that the extension is active and which workspace it is monitoring
last-source-signature.txt- stores the hash of the last processed set of changed source files
- prevents duplicate runs for identical source changes
- useful to understand whether a run was intentionally skipped as a duplicate
prompt-<timestamp>.txt- the exact Copilot prompt generated for a run
- contains the changed files, route info, instructions, and doc root constraints
- ideal for debugging why the model chose certain docs or ignored some files
logs/copilot-<timestamp>.log- raw stdout/stderr from the Copilot CLI invocation
- contains the actual command line and the model response/error text
- the most useful file when debugging agent selection, permission issues, prompt problems, or model errors
How these files help debug issues
If something fails, start with the newest files in .copilot/autodocsync:
- Read
autodocsync.logto see whether AutoDocSync started and whether it detected changes. - Open the newest
prompt-<timestamp>.txtto confirm the prompt matches the expected files and route. - Open the newest
logs/copilot-<timestamp>.logto inspect the agent invocation and model response or failure. - If a run was skipped, check
last-source-signature.txtto determine whether it was intentionally deduplicated.
This makes it much easier to diagnose:
- missing or incorrect config
- invalid agent name
- bad source glob matching
- no files detected under
src/** - Copilot CLI authentication issues
- route validation problems
- runtime exceptions while invoking the model
Default agent behavior (defaultAgent)
The defaultAgent field is the fallback agent name used when a route does not explicitly provide a matching agent or when no route matches the changed files.
Example:
"defaultAgent": "AutoDocSyncAgent"
Requirements / expectations
defaultAgent is optional. If it is provided, it should be an actual Copilot agent that exists in the environment where the extension is running. If the agent name is invalid, the Copilot CLI will fail with an error similar to:
No such agent: AutoDocSyncAgent
If no agent is provided, the extension will rely on the required instructionFiles instead.
Recommended pattern
- set
defaultAgentonly when you know a safe, repo-appropriate agent is available - set a route-level
agentonly when you want route-specific overrides - make sure every route includes:
instructionFileswith at least one file
- use
agentFileonly when you want to add extra agent guidance alongside the instruction files
If a route does not include instructionFiles, the extension rejects it during config validation.
Typical workflow in a repo
- Install the extension.
- Add
.github/autodocsync.json. - Add
.github/agents/autodocsync.agent.md. - Add
.github/instructions/autodocsync.instructions.md. - Open the repo in VS Code.
- Ensure the workspace is trusted.
- Start AutoDocSync from the VS Code command palette or extension commands.
- Change source files and let AutoDocSync update documentation.
Useful commands
Start AutoDocSync
From the VS Code command palette:
- AutoDocSync: Start
Run once manually
- AutoDocSync: Run Once
Open config/settings
- AutoDocSync: Open Configuration
Notes
- The extension only runs in trusted workspaces.
- Default config path is
.github/autodocsync.json. - Default log folder is
.copilot/autodocsync. - The
autodocsync.*settings namespace matches the package name.