# Remove Legacy Continue Chat — Complete ACP Migration

Complete the ACP migration by removing `packages/continuedev/` and all legacy code paths guarded by `!acpChat`.

**Branches:** `chore/remove-legacy-continue` in both repos.

**Key insight:** `acpChat` is already `default: true` (insider). Every `ExecutionLogger` consumer is behind `!acpChat` guards. The ACP architecture already handles all capabilities (sessions, approvals, execution events). This work is primarily **deletion of dead legacy branches**, not building new features.

---

## Task Execution Framework

Each task follows this loop:

```
┌─────────────────────────────────────────────────────────┐
│ 1. GATHER CONTEXT                                       │
│    Dispatch /context-gatherer sub-agent to build deep    │
│    knowledge of the files/modules relevant to the        │
│    current task.                                         │
├─────────────────────────────────────────────────────────┤
│ 2. IMPLEMENT                                            │
│    Dispatch /general-task-execution sub-agent.           │
│    Writes code + tests per the task's acceptance         │
│    criteria.                                            │
├─────────────────────────────────────────────────────────┤
│ 3. REVIEW                                               │
│    Dispatch a review-only /context-gatherer sub-agent.   │
│    Checks:                                              │
│    • All acceptance criteria pass                        │
│    • Code follows steering/style guides                  │
│    • No regressions introduced                          │
│    • Boundary respected (no out-of-scope changes)        │
├─────────────────────────────────────────────────────────┤
│ 4. FIX OR ADVANCE                                       │
│    • If review found issues → back to step 2            │
│    • If review passed → proceed to step 5               │
├─────────────────────────────────────────────────────────┤
│ 5. COMMIT                                               │
│    • Update this doc: add ✅ to completed task header    │
│    • Message: feat(scope): description                   │
│    • Stage only files touched by this task               │
│    • Do NOT push (wait for user)                         │
│    Then return to step 1 for the next task.              │
└─────────────────────────────────────────────────────────┘
```

---

## Tasks

### Task 1 ✅: Relocate types from `core` to `@kiro/shared-types`

**Concern:** The `"core"` workspace package exports types consumed by extension source. They need a home before `packages/continuedev/core` is deleted.

**Acceptance Criteria:**

- [x] Types `ChatMessage`, `MessagePart`, `PersistedSessionInfo`, `ChatHistory`, `ChatHistoryItem`, `ContextItemWithId`, `ContextSubmenuItem`, `GetContextItemsParameters` exist in `@kiro/shared-types`
- [x] All extension source files that imported `from 'core'` now import from `@kiro/shared-types`
- [x] `npm run compile` passes
- [x] No files under `packages/continuedev/` modified

**Commit:** `f92b4cd1c`

---

### Task 2: Hardcode `acpChat` to `true` and remove experiment flag

**Concern:** The `acpChat` experiment gate is the only thing keeping legacy code paths alive. Making it unconditionally `true` makes all `!acpChat` branches dead code that can be deleted.

**Acceptance Criteria:**

- [ ] `isExperimentsFeatureEnabled('acpChat')` always returns `true` (remove from experiment definitions, hardcode in service)
- [ ] The `acpChat` entry removed from `EXPERIMENT_DEFINITIONS` in `src/extension/experiments/experiments.ts`
- [ ] The `acpChat` override logic in `experiments-service.ts` (line 57) simplified
- [ ] `package.json` keybindings: remove `when: "!kiroAgent.experiments.acpChat"` entries and the duplicate `when: "kiroAgent.experiments.acpChat"` entries (keep only the ACP versions)
- [ ] `package.json` views: remove `when: "!kiroAgent.experiments.acpChat"` from `continueGUIView`, remove `when: "kiroAgent.experiments.acpChat"` from `acpChatView`
- [ ] `npm run compile` passes

**Files touched:**

- `src/extension/experiments/experiments.ts`
- `src/extension/experiments/experiments-service.ts`
- `package.json` (keybindings, views)

---

### Task 3: Delete legacy code branches guarded by `!acpChat`

**Concern:** ~28 call sites check `isExperimentsFeatureEnabled('acpChat')` and branch. With acpChat always-on, delete the `else` branches (which use `getExecutionLogger()`).

**Acceptance Criteria:**

- [ ] All `if (isExperimentsFeatureEnabled('acpChat')) { ... } else { ... }` patterns reduced to just the ACP path
- [ ] All `if (!isExperimentsFeatureEnabled('acpChat')) { ... }` blocks deleted
- [ ] No remaining imports of `isExperimentsFeatureEnabled` that only check `'acpChat'`
- [ ] `grep -rn "acpChat" src/extension/ --include="*.ts"` returns zero results (excluding test files)
- [ ] `npm run compile` passes

**Files touched (~28 files):**

- `src/extension/spec-editor/commands/execute-task.ts`
- `src/extension/spec-editor/commands/generate-spec-document-command.ts`
- `src/extension/spec-editor/commands/run-all-tasks.ts`
- `src/extension/spec-editor/index.ts`
- `src/extension/spec-editor/markdown-task-codelens-provider.ts`
- `src/extension/hooks/triggers/then-ask-agent.ts`
- `src/extension/hooks/triggers/then-run-command.ts`
- `src/extension/commands/quick-fix.ts`
- `src/extension/commands/chat-search.ts`
- `src/extension/powers/api/try-power.ts`
- `src/extension/mcp/index.ts`
- `src/extension/mcp/mcp-utility-commands.ts`
- `src/extension/mcp/mcp-tree-data-provider.ts`
- `src/extension/steering/commands/create-initial-steering.ts`
- `src/extension/steering/commands/refine-steering.ts`
- `src/extension/editor/hooks/index.ts`
- `src/extension/index.ts`
- `src/extension/config/sandbox-config-loader.ts`
- `src/extension/status-bar/sandbox-status-bar.ts`
- `src/extension/agent-chat/index.ts`

---

### Task 4: Remove `ExecutionLogger`, `getExecutionLogger()`, and dead consumers

**Concern:** With all legacy branches gone, `getExecutionLogger()` has zero callers. Remove it and all code that only existed to serve the old agent path.

**Acceptance Criteria:**

- [ ] `src/extension/utils/get-execution-logger.ts` deleted
- [ ] `src/extension/utils/build-session-services.ts` deleted (only served old agent)
- [ ] `src/extension/utils/get-session-details.ts` deleted or refactored (used `getExecutionLogger().getSessionDetails()`)
- [ ] `ExecutionLogger` type import removed from all files
- [ ] `activateContinue()` call removed from `src/extension.ts`
- [ ] `@continuedev/extension` removed from `devDependencies`
- [ ] `ExtensionApi` interface in `src/extension.ts` updated (no longer returns ExecutionLogger)
- [ ] `src/extension/rich-execution-log/controller/execution-log-connection-to-webview.ts` deleted (routed events to legacy webview)
- [ ] `src/extension/rich-execution-log/commands/supervised-diff-sync.ts` — remove `getExecutionLogger()` usage (ACP uses `supervised-approval-handler.ts`)
- [ ] `registerWithContinue()` deleted from `src/extension/context-lsp/index.ts`
- [ ] `npm run compile` passes
- [ ] `grep -rn "getExecutionLogger\|@continuedev/extension\|ExecutionLogger" src/ --include="*.ts"` returns zero (excluding test mocks being deleted)

**Files touched:**

- `src/extension.ts`
- `src/extension/utils/get-execution-logger.ts` (deleted)
- `src/extension/utils/build-session-services.ts` (deleted)
- `src/extension/utils/get-session-details.ts` (deleted or refactored)
- `src/extension/capabilities/tools/mcp-wrapper.ts` (remove ExecutionLogger usage)
- `src/extension/capabilities/tools/kiro-powers.ts` (remove ExecutionLogger usage)
- `src/extension/capabilities/tool-factories/shell.ts` (remove ExecutionLogger usage)
- `src/extension/capabilities/tool-factories/remote.ts` (remove ExecutionLogger usage)
- `src/extension/capabilities/tool-factories/fs.ts` (remove ExecutionLogger usage)
- `src/extension/capabilities/utils/protected-path-checker.ts` (remove ExecutionLogger usage)
- `src/extension/rich-execution-log/controller/execution-log-connection-to-webview.ts` (deleted)
- `src/extension/rich-execution-log/commands/supervised-diff-sync.ts`
- `src/extension/rich-execution-log/commands/subagent-continuation.ts`
- `src/extension/context-lsp/index.ts`
- `src/extension/commands/agent/chat-agent-command.ts`
- `src/extension/commands/agent/compact-agent-command.ts`
- `src/extension/commands/agent/create-hook.ts`
- `src/extension/editor/hooks/open-active-hook-execution.ts`
- `src/extension/editor/editor-api/spec-actions.ts`
- `src/extension/hooks/contextual/contextual-hook-actions.ts`
- `src/extension/hooks/utils/request-command-approval.ts`
- `src/extension/spec-editor/utils/abort-pending-executions.ts`
- `src/extension/spec-editor/utils/spec-session-tracking.ts`
- `src/extension/spec-editor/commands/execute-task.ts`
- `src/extension/spec-editor/commands/chat-to-fix-pbt.ts`
- `src/extension/spec-editor/commands/run-all-tasks.ts`
- `src/extension/spec-editor/commands/explorer-create-spec.ts`
- `src/extension/powers/api/try-power.ts`
- Test files referencing ExecutionLogger mocks

---

### Task 5: Create local `git-extension.d.ts` and fix relative import

**Concern:** `generate-commit-message.ts` imports types from `packages/continuedev/extension/src/otherExtensions/git.d.ts`.

**Acceptance Criteria:**

- [ ] `src/extension/commands/source-control/git-extension.d.ts` created with types from the original
- [ ] `generate-commit-message.ts` imports from local `.d.ts`
- [ ] `npm run compile` passes

**Files touched:**

- `src/extension/commands/source-control/git-extension.d.ts` (new)
- `src/extension/commands/source-control/generate-commit-message.ts`

---

### Task 6: Rename context provider directory and remove "continue" naming

**Concern:** The `providers/continue/` directory and its class names carry legacy branding.

**Acceptance Criteria:**

- [ ] Directory `src/extension/context-lsp/providers/continue/` → `providers/context-adapter/`
- [ ] `continue-adapter.ts` → `context-provider-adapter.ts`
- [ ] `continue-adapter.test.ts` → `context-provider-adapter.test.ts`
- [ ] Class `ContinueContextProviderAdapter` → `ContextProviderAdapter`
- [ ] Class `ContinueFileContextProvider` → `FileContextProvider`
- [ ] Method `stripContinueFormatting()` → `stripCodeBlockWrapping()`
- [ ] All imports updated; JSDoc comments reworded
- [ ] Tests pass

**Files touched:**

- `src/extension/context-lsp/providers/context-adapter/` (renamed)
- `src/extension/context-lsp/providers/index.ts`
- `src/extension/context-lsp/index.ts`

---

### Task 7: Delete `packages/continuedev/`

**Concern:** With all imports resolved and dead code removed, the package tree can be deleted.

**Acceptance Criteria:**

- [ ] `packages/continuedev/` directory deleted entirely
- [ ] `npm install` succeeds (workspace resolution works)
- [ ] `npm run compile` passes

---

### Task 8: Clean `package.json` manifest and related config

**Concern:** Manifest carries workspace entries, commands, views, scripts, and build config for the deleted system.

**Acceptance Criteria:**

- [ ] `workspaces` array: no `packages/continuedev/*` entries
- [ ] `activationEvents`: no `onView:continueGUIView`
- [ ] `contributes.commands`: no `focusContinueInput*` entries
- [ ] `contributes.views.continue`: no `kiroAgent.continueGUIView`
- [ ] `contributes.menus`: no entries referencing `continueGUIView`
- [ ] `contributes.keybindings`: no `focusContinueInput*` entries
- [ ] `contributes.languages`: no `.continuerc.json`
- [ ] `scripts`: no `watch:continue-extension`, `watch:continue-gui`
- [ ] `package.nls.json`: no `KiroAgent.command.focusContinueInput`
- [ ] `.vscodeignore`: no `packages/continuedev` lines
- [ ] `tsconfig.test.json`: no `packages/continuedev/core/**/*`
- [ ] `eslint.config.mjs`: no `packages/continuedev/` ignore patterns
- [ ] `configuration/eslint-continuedev-legacy.mjs` deleted
- [ ] `oss-attribution/attribution.md`: no `@continuedev/extension` row
- [ ] View container id `"continue"` kept for now (Phase 2 renames)
- [ ] `npm install && npm run compile && npx eslint src/` passes

**Files touched:**

- `package.json`
- `package.nls.json`
- `.vscodeignore`
- `tsconfig.test.json`
- `eslint.config.mjs`
- `configuration/eslint-continuedev-legacy.mjs` (deleted)
- `oss-attribution/attribution.md`

---

### Task 9: Clean build scripts and CI

**Concern:** Build scripts and CI workflows reference deleted paths.

**Acceptance Criteria:**

- [ ] `scripts/prepackage.mjs`: tokenizer copies removed (dead), tree-sitter comment updated
- [ ] `scripts/bump-kiro-agent.mjs`: no `packages/continuedev/core/package.json`
- [ ] `scripts/sync-dts-files.mjs`: no `packages/continuedev/extension` in `targetDirs`
- [ ] `.github/workflows/bump-agent-version.yaml`: no `packages/continuedev/core/package.json`
- [ ] `.github/CODEOWNERS`: no `packages/continuedev/` entries
- [ ] `npm run package` succeeds

**Files touched:**

- `scripts/prepackage.mjs`
- `scripts/bump-kiro-agent.mjs`
- `scripts/sync-dts-files.mjs`
- `.github/workflows/bump-agent-version.yaml`
- `.github/CODEOWNERS`

---

### Task 10: Update integration tests

**Concern:** Tests reference removed views, commands, and environment variables.

**Acceptance Criteria:**

- [ ] `integration-tests/constants.ts`: `WEBVIEW.CHAT` = `'kiroAgent.acpChatView'`
- [ ] `integration-tests/test-environment/mock-webview.ts`: `viewType` = `'kiroAgent.acpChatView'`
- [ ] `integration-tests/setup.ts`: no `process.env.CONTINUE_GLOBAL_DIR`
- [ ] All test files: `focusContinueInput` → `focusChatInput`
- [ ] Stale comments referencing `packages/continuedev/gui/` removed
- [ ] `grep -r "continueGUIView\|focusContinueInput\|CONTINUE_GLOBAL_DIR" integration-tests/ integration-tests-v2/` returns nothing
- [ ] Integration tests pass

**Files touched:**

- `integration-tests/constants.ts`
- `integration-tests/test-environment/mock-webview.ts`
- `integration-tests/setup.ts`
- `integration-tests/tests/chat-basics/keybindings.test.ts`
- `integration-tests-v2/src/tests/chat/chat-input-submission.test.ts`
- `integration-tests-v2/src/tests/chat/keybindings.test.ts`
- `integration-tests-v2/src/tests/agents/custom-agents.test.ts`
- `integration-tests-v2/src/tests/session-ui/session-ui-components-spec.test.ts`
- `integration-tests-v2/src/tests/usage-monitoring/usage-monitoring.test.ts`
- `integration-tests-v2/src/chat-harness.ts`

---

### Task 11: kiro-desktop — additive fallback changes

**Concern:** Desktop workbench hardcodes legacy view/command ids. Changes must be additive with graceful error handling.

**Acceptance Criteria:**

- [ ] `editorGroupAgentWatermark.ts`: uses `kiroAgent.focusChatInput`
- [ ] `compositeBar.ts`: restricted list includes both `continueGUIView` and `acpChatView`
- [ ] `gettingStarted.contribution.ts`: tries `acpChatView` first, falls back to `continueGUIView`
- [ ] `kiroUtils.ts`, `layout.ts`, `chat.ts`: unchanged
- [ ] Desktop builds clean
- [ ] Desktop tests pass

**Files touched (kiro-desktop):**

- `src/vs/workbench/browser/parts/editor/editorGroupAgentWatermark.ts`
- `src/vs/workbench/browser/parts/compositeBar.ts`
- `src/vs/workbench/contrib/welcomeGettingStarted/browser/gettingStarted.contribution.ts`

---

## Testing Plan

### kiro-extension — automated

| Step | Command                       | Validates                                             |
| ---- | ----------------------------- | ----------------------------------------------------- |
| 1    | `npm install`                 | Workspace resolution without `packages/continuedev/*` |
| 2    | `npm run compile`             | TypeScript compiles clean                             |
| 3    | `npx eslint src/`             | Lint passes without deleted eslint config             |
| 4    | `npm run test:kiro`           | Unit tests pass                                       |
| 5    | `npm run test:integration`    | v1 integration tests pass                             |
| 6    | `npm run test:integration-v2` | CDP integration tests pass                            |
| 7    | `npm run package`             | VSIX builds                                           |

### kiro-extension — manual (dev host)

| Check                                     | Validates                              |
| ----------------------------------------- | -------------------------------------- |
| Chat sidebar opens                        | `acpChatView` works under container    |
| `Cmd+L` / `Cmd+Shift+L` open chat         | Keybindings work                       |
| Context provider `#[[file:...]]` resolves | Renamed adapter works                  |
| Spec "Send to chat" focuses chat          | Command references updated             |
| Session migration reads v1 files          | `session-migration/` untouched         |
| MCP tool consent dialog works             | ACP permission flow active             |
| Supervised mode accept/reject works       | ACP supervised-approval-handler active |

### kiro-desktop — automated

| Step | Command                                                    | Validates         |
| ---- | ---------------------------------------------------------- | ----------------- |
| 1    | `./scripts/test.sh --glob "**/compositeBar*"`              | Drag restriction  |
| 2    | `./scripts/test.sh --glob "**/editorGroupAgentWatermark*"` | Watermark command |
| 3    | Full build                                                 | Compiles clean    |

### kiro-desktop — manual

| Check                              | Validates                      |
| ---------------------------------- | ------------------------------ |
| Empty editor watermark "Open chat" | `focusChatInput` command works |
| Chat panel restores on startup     | Auxiliary bar restore works    |
| Can't drag chat out of aux bar     | Restriction covers new id      |

### Smoke test (both repos)

Launch desktop with modified extension side-loaded:

- Chat opens and responds
- `Cmd+L`, `Cmd+Shift+L` work
- Sidebar appears on startup
- MCP tool asks for permission → approval works
- Supervised mode → accept/reject files works

---

## Coordination Strategy

**Phase 1** (this PR set):

- kiro-desktop: additive changes (new id lookups with fallback, keep old refs)
- kiro-extension: complete ACP migration — flip `acpChat` always-on, delete legacy branches, delete `packages/continuedev/`

**Phase 2** (follow-up after insider build):

- kiro-extension: rename container id `"continue"` → `"chat"`
- kiro-desktop: remove old id fallbacks, switch `workbench.view.extension.continue` → `workbench.view.extension.chat`

**Deploy order:** Desktop first (additive/safe). Extension second.

---

## Risks

| Risk                                                                           | Mitigation                                                                                       |
| ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ |
| Legacy code paths still reachable when `acpChat` flag is overridden to `false` | Remove the flag entirely — no opt-out                                                            |
| Code that serves both old and new paths (e.g. `supervised-diff-sync.ts`)       | Verify the ACP path (`supervised-approval-handler.ts`) covers all cases before deleting old path |
| Extension API surface changes                                                  | Check if anything depends on `getExtension('kiro').exports.getExecutionLogger()`                 |
| Tokenizer workers removed from `dist/`                                         | Confirmed dead — not imported in `src/`                                                          |
| Desktop breaks if extension ships first                                        | Desktop PR lands first (additive)                                                                |

---

## Preserve (do not touch)

- `src/extension/session-migration/` — reads v1 sessions from `continueGlobalPath` filesystem path
- `package.nls.json` line 82: `"Kiro.spec.createDocument": "Continue"` — verb, not brand
- `src/extension/agent-chat/supervised/supervised-approval-handler.ts` — this IS the ACP replacement for ExecutionLogger approval flows
