TaskSync
AGENTS.md634 starsChanged 7 months agoMITArchived repositoryView on GitHub
This file provides guidance for AI coding agents working on the TaskSync repository. TaskSync is a human-in-the-loop workflow toolkit for AI-assisted development. It provides two integration options: The primary active codebase is the VS Code extension in tasksync-chat/. All commands run from the tasksync-chat/ directory. Build output goes to dist/ (extension bundle), media/webview.js (webview bundle), and web/shared-constants.js (auto-generated for the remote PWA). Always run npm run validate after making changes. This runs build, tsc, vitest, lint, and the code quality…
- Installs packages
We split this AGENTS.md into the rules it gives an agent
21 rules. About 1 is common, 7 are distinctive, and 13 are very specific to this project.
≈1
Common · estimate
Many files like this have a rule of this kind.
≈7
Distinctive · estimate
This author's own choices. Worth a look.
13
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- could be automatic: a setting could enforce it
- Very specific: line 69
All commands run from the tasksync-chat/ directory.
- Very specific: line 103
Debug logging: Use debugLog() from webviewUtils.ts — gated behind tasksync.debugLogging config setting.
- Very specific: line 104
Error logging: Use console.error only for genuine error/failure paths.
- Very specific: line 105
Type assertions: Use satisfies over as for message types (e.g., } satisfies ToWebviewMessage)).
- Distinctive: line 106
Async I/O: Prefer async file operations over synchronous equivalents.
- Very specific: line 116
Single Source of Truth (SSOT): Every concept, constant, type, or piece of logic must have exactly one canonical definition.
- Distinctive: line 117
Don't Repeat Yourself (DRY): If logic is used in more than one place, extract it into a shared helper.
- Distinctive: line 118
Keep It Simple, Stupid (KISS): Prefer the simplest solution that works.
- Distinctive: line 119
You Aren't Gonna Need It (YAGNI): Do not add features, parameters, or code paths "just in case." Only implement what is needed for the …
- Very specific: line 120
Handler pattern: All handler modules (*Handlers.ts) receive a P interface — do not add direct imports from webviewProvider.ts.
- Very specific: line 142
Write operations (stage/unstage/discard/commit/push) are blocked remotely
- Very specific: line 153
Run npx vitest run to execute all tests.
- Very specific: line 159
Update package.json and package-lock.json version for the VS Code extension (e.g., 0.5.0 → 0.5.1).
- Distinctive: line 165
Follow OWASP Top 10 principles.
- Common: line 167
No credentials in code: Never commit secrets, API keys, or tokens.
- Distinctive: line 168
No blocking calls: Do not introduce synchronous blocking calls on the VS Code extension host.
- Very specific: line 169
No console.log/warn: Use debugLog() for debug output and console.error for genuine errors.
- Very specific: line 170
Timing-safe comparison: Use crypto.timingSafeEqual with SHA-256 digests for PIN/secret comparison.
- Very specific: line 172
Command injection prevention: Use child_process.spawn with argument arrays — never exec or string interpolation.
- Distinctive: line 173
Remote git safety: Keep remote Code Review endpoints read-only unless explicitly redesigning the threat model and permission model.
- Very specific: line 176
Origin validation: Check Origin and Host headers on WebSocket upgrade requests.
≈ “Common” is an estimate: at least 1 in 5 of the 36,368 AGENTS.md 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
AGENTS.md — TaskSync Development Guide
This file provides guidance for AI coding agents working on the TaskSync repository.
Repository Overview
TaskSync is a human-in-the-loop workflow toolkit for AI-assisted development. It provides two integration options:
- TaskSync VS Code Extension (
tasksync-chat/) — A sidebar extension with smart prompt queuing, Autopilot, Consistent mode forask_userbehavior, and remote access with read-only Code Review. - TaskSync Prompt (
Prompt/) — Terminal-based agent protocols (Markdown prompts for use as AI instructions).
The primary active codebase is the VS Code extension in tasksync-chat/.
Repository Structure
TaskSync/
├── AGENTS.md # This file
├── CHANGELOG.md # Release history
├── README.md # Project overview
├── LICENSE
├── Prompt/ # Standalone prompt/protocol markdown files
│ ├── tasksync-v5.2.md
│ ├── tasksync-v5.1.md
│ ├── tasksync-v5.md
│ ├── tasksync_v4.md
│ └── specs-tasksync.md
└── tasksync-chat/ # VS Code extension (main codebase)
├── src/
│ ├── extension.ts # Extension entry point
│ ├── tools.ts # VS Code language model tool definitions
│ ├── constants/ # Shared constants (config keys, file exclusions)
│ ├── context/ # Context providers (files, terminal, problems)
│ ├── server/ # Remote access server, auth, git, HTML service
│ ├── utils/ # Shared utilities (ID generation, image handling, chat session helpers)
│ └── webview/
│ ├── webviewProvider.ts # Sidebar webview provider (orchestrator)
│ ├── webviewTypes.ts # Shared types (P interface, message unions)
│ ├── webviewUtils.ts # Shared helpers (debugLog, mergeAndDedup, etc.)
│ ├── messageRouter.ts # Webview ↔ extension message dispatch
│ ├── toolCallHandler.ts # ask_user tool lifecycle and AI turn tracking
│ ├── choiceParser.ts # Parse approval/choice questions into UI buttons
│ ├── queueHandlers.ts # Queue operations (add, remove, reorder, toggle)
│ ├── lifecycleHandlers.ts# Setup, dispose, new session
│ ├── sessionManager.ts # Session timer, sound notifications
│ ├── persistence.ts # Disk I/O for queue and history
│ ├── settingsHandlers.ts # Settings read/write, UI sync
│ ├── fileHandlers.ts # File search, attachments, context references
│ └── remoteApiHandlers.ts# Remote client message handling
│ └── webview-ui/ # Webview frontend (JS/CSS, no framework)
├── media/ # Icons, webview JS/CSS assets
├── web/ # Remote access PWA (login page, service worker)
├── e2e/ # Playwright e2e smoke tests
├── package.json
├── tsconfig.json
├── biome.json # Linter/formatter config
├── vitest.config.ts # Test config
└── esbuild.js # Bundler configDevelopment Setup
All commands run from the tasksync-chat/ directory.
cd tasksync-chat
npm install| Task | Command |
| Build | node esbuild.js |
| Type-check | npx tsc --noEmit |
| Test | npx vitest run |
| Lint | npm run lint |
| Code quality | npm run check-code |
| Full validation | npm run validate |
| Watch mode | npm run watch |
| Package VSIX | npx vsce package |
Build output goes to
dist/(extension bundle),media/webview.js(webview bundle), andweb/shared-constants.js(auto-generated for the remote PWA).Always run
npm run validateafter making changes. This runs build, tsc, vitest, lint, and the code quality scanner.
Linting note: This repo is Biome-first.
npx eslintis not configured by default (noeslint.config.*), so usenpm run lint.
Code Conventions
- Language: TypeScript with
"strict": true - Target: ES2022, CommonJS modules
- Indentation: Tabs (enforced by Biome)
- Quotes: Double quotes for JavaScript/TypeScript strings (enforced by Biome)
- Linter/Formatter: Biome — run
npm run lintbefore committing - Imports: Organised automatically by Biome (
organizeImports: on) - Debug logging: Use
debugLog()fromwebviewUtils.ts— gated behindtasksync.debugLoggingconfig setting. Never useconsole.logorconsole.warnin production code. - Error logging: Use
console.erroronly for genuine error/failure paths. - Type assertions: Use
satisfiesoverasfor message types (e.g.,} satisfies ToWebviewMessage)). Thesatisfieskeyword validates shape at compile time;assilently bypasses checks. - Async I/O: Prefer async file operations over synchronous equivalents.
- Promises:
IncomingRequestobjects must store bothresolveandrejectfor proper cleanup on dispose. - DRY: Shared logic goes in
webviewUtils.ts. Examples:debugLog(),mergeAndDedup(),notifyQueueChanged(),hasQueuedItems(),resolveFilePath()(gitService).
SSOT / DRY / KISS / YAGNI Principles
These principles are mandatory for all changes:
- Single Source of Truth (SSOT): Every concept, constant, type, or piece of logic must have exactly one canonical definition. Constants live in
src/constants/. Shared types live inwebviewTypes.ts. Shared helpers live inwebviewUtils.ts. - Don't Repeat Yourself (DRY): If logic is used in more than one place, extract it into a shared helper. When you see the same pattern in 3+ call sites, extract it.
- Keep It Simple, Stupid (KISS): Prefer the simplest solution that works. Do not add abstraction layers without clear justification. A small amount of duplication is acceptable if the alternative is a complex abstraction for only 2 call sites.
- You Aren't Gonna Need It (YAGNI): Do not add features, parameters, or code paths "just in case." Only implement what is needed for the current task.
- Handler pattern: All handler modules (
*Handlers.ts) receive aPinterface — do not add direct imports fromwebviewProvider.ts. This prevents circular dependencies.
Key Architectural Notes
- The
ask_userVS Code language model tool is the core interaction primitive. It is registered intools.tsand handled intoolCallHandler.ts. - The
ask_userinput schema only acceptsquestion - The
ask_userresult payload is compact by design:responseis always includedqueuedis only included whentrueattachmentCountis only included when greater than0instructionis only included when Consistent mode is enabled
webviewProvider.tsis the orchestrator — it owns state, creates the webview, and delegates to handler modules.- Handler modules (
*Handlers.ts) receive aPinterface (defined inwebviewTypes.ts) that exposes provider state and methods without circular imports. - Queue, history, and settings are per-workspace (workspace-scoped storage with global fallback).
- Consistent mode is controlled by
tasksync.askUserVerbosePayloadand mirrored throughsettingsHandlers.ts+webview-uitoggle wiring. - Session state uses a boolean
sessionTerminatedflag — do not use string matching for termination detection. - Debounced history saves (2 s) are used for disk I/O performance.
- New Session now supports a modal-first flow and starts a fresh Copilot chat session via
startFreshCopilotChatWithQuery. - Remote Code Review is read-only by design:
- Diff browsing is available (
/api/changes,/api/diff) - Write operations (stage/unstage/discard/commit/push) are blocked remotely
- Diff browsing is available (
- The remote server (
server/) uses WebSocket + HTTP endpoints. Auth is OTP/PIN-based with session tokens, and API requests preferx-tasksync-sessiontoken auth when available.
Testing
- Framework: Vitest (14 test files, 387+ tests, ~98% coverage)
- Mocks: VS Code API is mocked in
src/__mocks__/vscode.ts - Test setup: Tests that use git operations must set
(vscode.workspace as any).workspaceFoldersinbeforeEach - Coverage: Maintain or improve coverage. Add tests for security-sensitive code, edge cases, and error handling paths.
- Run
npx vitest runto execute all tests. Always verify tests pass after changes.
Versioning
- Update package.json and package-lock.json version for the VS Code extension (e.g.,
0.5.0→0.5.1).
Security & Responsible Use
Follow OWASP Top 10 principles. Specific patterns enforced in this codebase:
- No credentials in code: Never commit secrets, API keys, or tokens.
- No blocking calls: Do not introduce synchronous blocking calls on the VS Code extension host.
- No console.log/warn: Use
debugLog()for debug output andconsole.errorfor genuine errors. - Timing-safe comparison: Use
crypto.timingSafeEqualwith SHA-256 digests for PIN/secret comparison. SeeremoteAuthService.ts. - Path traversal prevention: Validate all remote file paths with
isValidFilePath()ingitService.ts. Usepath.isAbsolute()instead ofstartsWith("/"). - Command injection prevention: Use
child_process.spawnwith argument arrays — neverexecor string interpolation. - Remote git safety: Keep remote Code Review endpoints read-only unless explicitly redesigning the threat model and permission model.
- Input validation at boundaries: Validate all user/remote input at the entry point. Trust internal code deeper in call stacks.
- Security headers: Set CSP, X-Content-Type-Options, X-Frame-Options, and X-XSS-Protection on all HTTP responses.
- Origin validation: Check
OriginandHostheaders on WebSocket upgrade requests.
Where files are headingNew AGENTS.md files have more rules about keeping secrets out of the code, and fewer about code style.
Of the AGENTS.md files we read, the 28,693 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.
In this repositoryOne other file it gives its agents.
- .github/copilot-instructions.mdCopilot instructions
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.

