claude: Bash live-tail detection + read-only file follower (T-325, core)

The detection/follow core for the live-tail sub-card, with the UI wiring
to follow. Claude Code runs every Bash tool itself and clide only sees the
final tool_result block — we can't mirror the running process, so instead
we detect a file-backed source the command follows and open our own
read-only follower on the same file.

- bash_tail_source.dart: detectBashTailSource() parses a Bash command for a
  single, safe, file-backed source (tail/cat/less with one file arg, inside
  the workspace via resolveUnderRoot). Returns null for a pipe-into-tail, a
  redirect, two files, or a path outside the repo — the caller then shows a
  "nothing to follow" note. bashHasTailIntent() gates WHEN the segment
  appears: v1 triggers on `tail`/follow-flags only, so ordinary cat/ls/git
  cards stay clean (cat/less remain detectable for later).
- file_tail_follower.dart: a polling, read-only `tail -f`-style follower
  (no subprocess, no touching Claude's command) that emits the trailing
  window then appended deltas, and re-reads from the top on truncation.

Tested: 19 parser cases (incl. the `git push | tail -25` and outside-
workspace null cases), the intent predicate, and the follower (initial
window / appended delta / missing file / rotation / start / stop).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-06-11 17:12:53 +02:00
co-authored by Claude Opus 4.8
parent d43ddfed9c
commit 898a0316e5
10 changed files with 510 additions and 0 deletions
@@ -3625,3 +3625,10 @@ D-41 (tmux session persistence); `lib/src/build_info.g.dart` (version source);
(`app.*.enabled`, `lib/kernel/src/extensions_manager.dart`); `Makefile` install target
(per-platform layout); parent epic T-46 (cross-platform installer).', NULL, '2026-06-11 13:30:03', '2026-06-11 13:30:03', '2026-06-11 13:30:03', NULL, 'cf37ae15ac8dbf59eb23e98fef32427f', 2) ON CONFLICT(hash) DO NOTHING;
INSERT INTO ticket_history (ticket_record_id, field, old_value, new_value, changed_by, changed_at, created_at, updated_at, deleted_at, hash, canonical_version) VALUES ('06FB0TNQM7CEKQCMZAV751402G', 'status', 'ready', 'backlog', NULL, '2026-06-11 13:30:47', '2026-06-11 13:30:47', '2026-06-11 13:30:47', NULL, '2c566e731dfce3b9e111c1c1c50ec642', 2) ON CONFLICT(hash) DO NOTHING;
INSERT INTO ticket_history (ticket_record_id, field, old_value, new_value, changed_by, changed_at, created_at, updated_at, deleted_at, hash, canonical_version) VALUES ('06FBDSJYQFDNKP4KA1JAEDSS8W', 'description', NULL, 'Eliminate the out-of-repo pql dependency friction: clide ships its own pinned pql and owns first-open workspace setup. Spans four decisions — D-92 (bundle pql), D-93 (zero clide dirs in-repo), D-94 (workspace modes), D-95 (onboarding + read-mode). Outcome: a fresh clone/install of clide works with no separate pql install or version coordination; the repo''s only tool dirs are .git/ and .pql/. Three epics: T-355 bundle, T-356 footprint, T-357 onboarding.', NULL, '2026-06-11 13:37:57', '2026-06-11 13:37:57', '2026-06-11 13:37:57', NULL, '02cfffe1db3519f397186ca4cc80d736', 2) ON CONFLICT(hash) DO NOTHING;
INSERT INTO ticket_history (ticket_record_id, field, old_value, new_value, changed_by, changed_at, created_at, updated_at, deleted_at, hash, canonical_version) VALUES ('06FBDSKGAHYHH2NPZK8B6EV4D4', 'description', NULL, 'Vendor a version-pinned pql binary per shipped platform under native/<platform>/, following the dugite pattern (D-59/D-63): BUILD.md provenance (upstream commit SHA, build command, toolchain, sha256), assets/licenses.yaml entry (D-42/D-65). Add a bundled-first resolver mirroring _resolveDugiteGit() in lib/kernel/src/toolchain_paths.dart: CLIDE_PQL_BIN env override -> binary next to the executable -> system pql on PATH (currently pql is PATH-only via _findOnPath at line 88). SECURITY: resolve against the install dir only, never workspace-relative — a planted ./native/pql is a code-exec vector (the T-98 dugite lesson). Bundled copy must not self-update. Add a soft version-floor check that surfaces an out-of-date override/PATH pql in the Problems panel. Switch CI to run the in-tree binary instead of assuming pql on the runner.', NULL, '2026-06-11 13:38:05', '2026-06-11 13:38:05', '2026-06-11 13:38:05', NULL, '7965e1306d3c064cee76f6537d5ad237', 2) ON CONFLICT(hash) DO NOTHING;
INSERT INTO ticket_history (ticket_record_id, field, old_value, new_value, changed_by, changed_at, created_at, updated_at, deleted_at, hash, canonical_version) VALUES ('06FBDSM0PRGYR61R0NWYAT9VDC', 'description', NULL, 'Move clide''s project-scoped state out of the in-repo .clide/ dir into user scope, keyed by a workspace-path hash (reuse the FNV-1a convention from D-70''s IPC socket path). Affected today: SettingsStore project file (_projectFile -> .clide/settings.yaml in lib/kernel/src/settings.dart) and theme_persistence.dart (project.theme). Provide a one-time migration that relocates an existing .clide/settings.yaml to user scope and removes the dir. Drop .clide/ from the gitignore-at-install set (only .pql/ remains). If shared/committed clide config is ever needed, it goes as clide-owned keys in .pql/config.yaml, not a new dir. Note: the open extension-DB question (governance/questions/process.md Q on .clide/clide.db) now assumes a user-scope DB. Accept D-70''s trade-off: moving/renaming a repo re-keys it and resets personal layout.', NULL, '2026-06-11 13:38:13', '2026-06-11 13:38:13', '2026-06-11 13:38:13', NULL, '08f32bc29f3cfce247957d66415d85e4', 2) ON CONFLICT(hash) DO NOTHING;
INSERT INTO ticket_history (ticket_record_id, field, old_value, new_value, changed_by, changed_at, created_at, updated_at, deleted_at, hash, canonical_version) VALUES ('06FBDSPECQ0FPKB9SYTD7KZSBM', 'description', NULL, 'Add a first-open, idempotent workspace prep flow that reconciles state (virgin / pql-user / partially-init / fully-init / previously-declined) rather than blindly running pql init. Two ordered gates: (1) non-git folder -> OFFER git init, default NO, with a guard that warns when a parent .git would create a nested repo; or pick another folder. (2) pql provisioning, now that pql ships bundled (T-355): config+index is the mandatory floor (the files/query/ignore engine); the planning layer (decisions/tickets + changelog hooks, D-67) is a CONTEXTUAL opt-in offered at first open of the Decisions/Tickets surface, with disclosure. The modal must disclose everything it writes (.gitignore entries, pql config, and — opt-in only — git hooks). Handle the friction.md gotcha: pql init writes to .git/hooks and ignores an existing core.hooksPath; do not clobber it. Writable repo w/o .pql = invalid-until-init. Unwritable repo (read-only mount / no perms) -> degrade to read mode: file tree + editor + D-79 grep stay live, pql surfaces dark behind a banner (depends on T-358 modes). Remember a decline in user scope keyed by repo path; provide an explicit ''initialize workspace'' command; no re-nagging.', NULL, '2026-06-11 13:38:23', '2026-06-11 13:38:23', '2026-06-11 13:38:23', NULL, '47e2d75302ec95305ff1cacd2afc2a26', 2) ON CONFLICT(hash) DO NOTHING;
INSERT INTO ticket_history (ticket_record_id, field, old_value, new_value, changed_by, changed_at, created_at, updated_at, deleted_at, hash, canonical_version) VALUES ('06FBDSQ2GBSP0ZH4RHZG2PMR0R', 'description', NULL, 'Introduce a ''modes'' capability in the extension manifest (lib/extension/src/manifest.dart) as an open vocabulary: edit and read now, with remote/ssh/webui reserved (D-94). The extension host (lib/extension/src/host.dart) activates an extension only when the active workspace mode is in its declared set; an undeclared extension defaults to edit-only. Then classify the builtins: read-mode-safe = editor (view), files (tree + D-79 grep), git (status/log/diff viewing), terminal, claude; goes dark = pql (search/query/backlinks), decisions, tickets, graph; partial = problems (keep non-pql diagnostics, drop the pql.doctor row). This is the substrate read-mode degrade (T-357) gates on, and the seam the SSH-remote question (Q-23) is expected to resolve into.', NULL, '2026-06-11 13:38:31', '2026-06-11 13:38:31', '2026-06-11 13:38:31', NULL, 'ba0a16d581d6c81fd0cc39ffab15887d', 2) ON CONFLICT(hash) DO NOTHING;
INSERT INTO ticket_history (ticket_record_id, field, old_value, new_value, changed_by, changed_at, created_at, updated_at, deleted_at, hash, canonical_version) VALUES ('06FB2T11GCV1EV07DYD5BZENTM', 'status', 'ready', 'in_progress', NULL, '2026-06-11 14:18:34', '2026-06-11 14:18:34', '2026-06-11 14:18:34', NULL, 'a2a75bcb471d6eba8a215d56922c6337', 2) ON CONFLICT(hash) DO NOTHING;
INSERT INTO ticket_history (ticket_record_id, field, old_value, new_value, changed_by, changed_at, created_at, updated_at, deleted_at, hash, canonical_version) VALUES ('06FB2T11GCV1EV07DYD5BZENTM', 'status', 'in_progress', 'in_progress', NULL, '2026-06-11 14:59:53', '2026-06-11 14:59:53', '2026-06-11 14:59:53', NULL, '96bef4f722871cb468f67b55d6447acc', 2) ON CONFLICT(hash) DO NOTHING;
+5
View File
@@ -178,3 +178,8 @@ INSERT INTO ticket_idmap (record_id, ticket_id, created_at, updated_at, deleted_
INSERT INTO ticket_idmap (record_id, ticket_id, created_at, updated_at, deleted_at, hash, canonical_version) VALUES ('06FB5HMYDXP62RKH3HP55T6AYG', 'T-351', '2026-06-10 18:23:41', '2026-06-10 18:23:41', NULL, '9d2da44c16c5aa38c0a36e4b00ef5f15', 2) ON CONFLICT(record_id) DO UPDATE SET ticket_id=excluded.ticket_id, updated_at=excluded.updated_at, deleted_at=excluded.deleted_at, hash=excluded.hash, canonical_version=excluded.canonical_version WHERE excluded.updated_at > ticket_idmap.updated_at OR (excluded.updated_at = ticket_idmap.updated_at AND excluded.hash > ticket_idmap.hash);
INSERT INTO ticket_idmap (record_id, ticket_id, created_at, updated_at, deleted_at, hash, canonical_version) VALUES ('06FB5M14B76B31654D959XM5AC', 'T-352', '2026-06-10 18:34:05', '2026-06-10 18:34:05', NULL, '3fe3e1d5fb7c0fbd084b45116575ad98', 2) ON CONFLICT(record_id) DO UPDATE SET ticket_id=excluded.ticket_id, updated_at=excluded.updated_at, deleted_at=excluded.deleted_at, hash=excluded.hash, canonical_version=excluded.canonical_version WHERE excluded.updated_at > ticket_idmap.updated_at OR (excluded.updated_at = ticket_idmap.updated_at AND excluded.hash > ticket_idmap.hash);
INSERT INTO ticket_idmap (record_id, ticket_id, created_at, updated_at, deleted_at, hash, canonical_version) VALUES ('06FBAWHM1SQ1686ZJ8JQCFQ1ZW', 'T-353', '2026-06-11 06:50:21', '2026-06-11 06:50:21', NULL, '53374633101d04f94981baaf4f2e0315', 2) ON CONFLICT(record_id) DO UPDATE SET ticket_id=excluded.ticket_id, updated_at=excluded.updated_at, deleted_at=excluded.deleted_at, hash=excluded.hash, canonical_version=excluded.canonical_version WHERE excluded.updated_at > ticket_idmap.updated_at OR (excluded.updated_at = ticket_idmap.updated_at AND excluded.hash > ticket_idmap.hash);
INSERT INTO ticket_idmap (record_id, ticket_id, created_at, updated_at, deleted_at, hash, canonical_version) VALUES ('06FBDSJYQFDNKP4KA1JAEDSS8W', 'T-354', '2026-06-11 13:36:51', '2026-06-11 13:36:51', NULL, '32bb5d359401599022a8771031d8a08a', 2) ON CONFLICT(record_id) DO UPDATE SET ticket_id=excluded.ticket_id, updated_at=excluded.updated_at, deleted_at=excluded.deleted_at, hash=excluded.hash, canonical_version=excluded.canonical_version WHERE excluded.updated_at > ticket_idmap.updated_at OR (excluded.updated_at = ticket_idmap.updated_at AND excluded.hash > ticket_idmap.hash);
INSERT INTO ticket_idmap (record_id, ticket_id, created_at, updated_at, deleted_at, hash, canonical_version) VALUES ('06FBDSKGAHYHH2NPZK8B6EV4D4', 'T-355', '2026-06-11 13:36:55', '2026-06-11 13:36:55', NULL, '2eb6809e958613a924b35e080ab17609', 2) ON CONFLICT(record_id) DO UPDATE SET ticket_id=excluded.ticket_id, updated_at=excluded.updated_at, deleted_at=excluded.deleted_at, hash=excluded.hash, canonical_version=excluded.canonical_version WHERE excluded.updated_at > ticket_idmap.updated_at OR (excluded.updated_at = ticket_idmap.updated_at AND excluded.hash > ticket_idmap.hash);
INSERT INTO ticket_idmap (record_id, ticket_id, created_at, updated_at, deleted_at, hash, canonical_version) VALUES ('06FBDSM0PRGYR61R0NWYAT9VDC', 'T-356', '2026-06-11 13:37:00', '2026-06-11 13:37:00', NULL, 'bdb597080218a3e8783f6c5cf74c529a', 2) ON CONFLICT(record_id) DO UPDATE SET ticket_id=excluded.ticket_id, updated_at=excluded.updated_at, deleted_at=excluded.deleted_at, hash=excluded.hash, canonical_version=excluded.canonical_version WHERE excluded.updated_at > ticket_idmap.updated_at OR (excluded.updated_at = ticket_idmap.updated_at AND excluded.hash > ticket_idmap.hash);
INSERT INTO ticket_idmap (record_id, ticket_id, created_at, updated_at, deleted_at, hash, canonical_version) VALUES ('06FBDSPECQ0FPKB9SYTD7KZSBM', 'T-357', '2026-06-11 13:37:19', '2026-06-11 13:37:19', NULL, '96cf88e036dc3a45487cdbffff26cdde', 2) ON CONFLICT(record_id) DO UPDATE SET ticket_id=excluded.ticket_id, updated_at=excluded.updated_at, deleted_at=excluded.deleted_at, hash=excluded.hash, canonical_version=excluded.canonical_version WHERE excluded.updated_at > ticket_idmap.updated_at OR (excluded.updated_at = ticket_idmap.updated_at AND excluded.hash > ticket_idmap.hash);
INSERT INTO ticket_idmap (record_id, ticket_id, created_at, updated_at, deleted_at, hash, canonical_version) VALUES ('06FBDSQ2GBSP0ZH4RHZG2PMR0R', 'T-358', '2026-06-11 13:37:25', '2026-06-11 13:37:25', NULL, '2a656aaec54bf50c34c7e28347b1fb29', 2) ON CONFLICT(record_id) DO UPDATE SET ticket_id=excluded.ticket_id, updated_at=excluded.updated_at, deleted_at=excluded.deleted_at, hash=excluded.hash, canonical_version=excluded.canonical_version WHERE excluded.updated_at > ticket_idmap.updated_at OR (excluded.updated_at = ticket_idmap.updated_at AND excluded.hash > ticket_idmap.hash);
+68
View File
@@ -3573,3 +3573,71 @@ D-41 (tmux session persistence); `lib/src/build_info.g.dart` (version source);
`lib/kernel/src/toast.dart` (ToastService the notification); settings bool pattern
(`app.*.enabled`, `lib/kernel/src/extensions_manager.dart`); `Makefile` install target
(per-platform layout); parent epic T-46 (cross-platform installer).', 'backlog', 'medium', NULL, NULL, NULL, '2026-04-23 20:28:43', '2026-06-11 13:30:47', NULL, '28d5684adc9127f1306bddaaff8d1f77', 2) ON CONFLICT(record_id) DO UPDATE SET type=excluded.type, parent_record_id=excluded.parent_record_id, title=excluded.title, description=excluded.description, status=excluded.status, priority=excluded.priority, assigned_to=excluded.assigned_to, team=excluded.team, decision_ref=excluded.decision_ref, updated_at=excluded.updated_at, deleted_at=excluded.deleted_at, hash=excluded.hash, canonical_version=excluded.canonical_version WHERE excluded.updated_at > tickets.updated_at OR (excluded.updated_at = tickets.updated_at AND excluded.hash > tickets.hash);
INSERT INTO tickets (record_id, type, parent_record_id, title, description, status, priority, assigned_to, team, decision_ref, created_at, updated_at, deleted_at, hash, canonical_version) VALUES ('06FBDSJYQFDNKP4KA1JAEDSS8W', 'initiative', NULL, 'Internalize pql: bundle the binary and own workspace onboarding', NULL, 'backlog', 'medium', NULL, NULL, 'D-92', '2026-06-11 13:36:51', '2026-06-11 13:36:51', NULL, '28d6eb7a1b8658ae5db18328446cbf69', 2) ON CONFLICT(record_id) DO UPDATE SET type=excluded.type, parent_record_id=excluded.parent_record_id, title=excluded.title, description=excluded.description, status=excluded.status, priority=excluded.priority, assigned_to=excluded.assigned_to, team=excluded.team, decision_ref=excluded.decision_ref, updated_at=excluded.updated_at, deleted_at=excluded.deleted_at, hash=excluded.hash, canonical_version=excluded.canonical_version WHERE excluded.updated_at > tickets.updated_at OR (excluded.updated_at = tickets.updated_at AND excluded.hash > tickets.hash);
INSERT INTO tickets (record_id, type, parent_record_id, title, description, status, priority, assigned_to, team, decision_ref, created_at, updated_at, deleted_at, hash, canonical_version) VALUES ('06FBDSKGAHYHH2NPZK8B6EV4D4', 'epic', '06FBDSJYQFDNKP4KA1JAEDSS8W', 'Bundle and resolve pql as a vendored pinned binary', NULL, 'backlog', 'medium', NULL, NULL, 'D-92', '2026-06-11 13:36:55', '2026-06-11 13:36:55', NULL, 'cd19e7f43063ceaa61e8cb0dc68a6268', 2) ON CONFLICT(record_id) DO UPDATE SET type=excluded.type, parent_record_id=excluded.parent_record_id, title=excluded.title, description=excluded.description, status=excluded.status, priority=excluded.priority, assigned_to=excluded.assigned_to, team=excluded.team, decision_ref=excluded.decision_ref, updated_at=excluded.updated_at, deleted_at=excluded.deleted_at, hash=excluded.hash, canonical_version=excluded.canonical_version WHERE excluded.updated_at > tickets.updated_at OR (excluded.updated_at = tickets.updated_at AND excluded.hash > tickets.hash);
INSERT INTO tickets (record_id, type, parent_record_id, title, description, status, priority, assigned_to, team, decision_ref, created_at, updated_at, deleted_at, hash, canonical_version) VALUES ('06FBDSM0PRGYR61R0NWYAT9VDC', 'epic', '06FBDSJYQFDNKP4KA1JAEDSS8W', 'Single-directory workspace footprint: relocate IDE state to user scope', NULL, 'backlog', 'medium', NULL, NULL, 'D-93', '2026-06-11 13:37:00', '2026-06-11 13:37:00', NULL, 'e81d105b64347dfb59a81a28cbc1c594', 2) ON CONFLICT(record_id) DO UPDATE SET type=excluded.type, parent_record_id=excluded.parent_record_id, title=excluded.title, description=excluded.description, status=excluded.status, priority=excluded.priority, assigned_to=excluded.assigned_to, team=excluded.team, decision_ref=excluded.decision_ref, updated_at=excluded.updated_at, deleted_at=excluded.deleted_at, hash=excluded.hash, canonical_version=excluded.canonical_version WHERE excluded.updated_at > tickets.updated_at OR (excluded.updated_at = tickets.updated_at AND excluded.hash > tickets.hash);
INSERT INTO tickets (record_id, type, parent_record_id, title, description, status, priority, assigned_to, team, decision_ref, created_at, updated_at, deleted_at, hash, canonical_version) VALUES ('06FBDSPECQ0FPKB9SYTD7KZSBM', 'epic', '06FBDSJYQFDNKP4KA1JAEDSS8W', 'Workspace onboarding flow and read-mode degrade', NULL, 'backlog', 'medium', NULL, NULL, 'D-95', '2026-06-11 13:37:19', '2026-06-11 13:37:19', NULL, '91b0ac3a4bb69c24f7c9eef9034f7ca3', 2) ON CONFLICT(record_id) DO UPDATE SET type=excluded.type, parent_record_id=excluded.parent_record_id, title=excluded.title, description=excluded.description, status=excluded.status, priority=excluded.priority, assigned_to=excluded.assigned_to, team=excluded.team, decision_ref=excluded.decision_ref, updated_at=excluded.updated_at, deleted_at=excluded.deleted_at, hash=excluded.hash, canonical_version=excluded.canonical_version WHERE excluded.updated_at > tickets.updated_at OR (excluded.updated_at = tickets.updated_at AND excluded.hash > tickets.hash);
INSERT INTO tickets (record_id, type, parent_record_id, title, description, status, priority, assigned_to, team, decision_ref, created_at, updated_at, deleted_at, hash, canonical_version) VALUES ('06FBDSQ2GBSP0ZH4RHZG2PMR0R', 'task', '06FBDSPECQ0FPKB9SYTD7KZSBM', 'Declared extension modes (manifest) + classify builtins as read-mode-safe', NULL, 'backlog', 'medium', NULL, NULL, 'D-94', '2026-06-11 13:37:25', '2026-06-11 13:37:25', NULL, '1aa454e0f1de6710b57c7fd56fd5194a', 2) ON CONFLICT(record_id) DO UPDATE SET type=excluded.type, parent_record_id=excluded.parent_record_id, title=excluded.title, description=excluded.description, status=excluded.status, priority=excluded.priority, assigned_to=excluded.assigned_to, team=excluded.team, decision_ref=excluded.decision_ref, updated_at=excluded.updated_at, deleted_at=excluded.deleted_at, hash=excluded.hash, canonical_version=excluded.canonical_version WHERE excluded.updated_at > tickets.updated_at OR (excluded.updated_at = tickets.updated_at AND excluded.hash > tickets.hash);
INSERT INTO tickets (record_id, type, parent_record_id, title, description, status, priority, assigned_to, team, decision_ref, created_at, updated_at, deleted_at, hash, canonical_version) VALUES ('06FBDSJYQFDNKP4KA1JAEDSS8W', 'initiative', NULL, 'Internalize pql: bundle the binary and own workspace onboarding', 'Eliminate the out-of-repo pql dependency friction: clide ships its own pinned pql and owns first-open workspace setup. Spans four decisions — D-92 (bundle pql), D-93 (zero clide dirs in-repo), D-94 (workspace modes), D-95 (onboarding + read-mode). Outcome: a fresh clone/install of clide works with no separate pql install or version coordination; the repo''s only tool dirs are .git/ and .pql/. Three epics: T-355 bundle, T-356 footprint, T-357 onboarding.', 'backlog', 'medium', NULL, NULL, 'D-92', '2026-06-11 13:36:51', '2026-06-11 13:37:57', NULL, 'fef23cd1e616df992b40126e76cd4377', 2) ON CONFLICT(record_id) DO UPDATE SET type=excluded.type, parent_record_id=excluded.parent_record_id, title=excluded.title, description=excluded.description, status=excluded.status, priority=excluded.priority, assigned_to=excluded.assigned_to, team=excluded.team, decision_ref=excluded.decision_ref, updated_at=excluded.updated_at, deleted_at=excluded.deleted_at, hash=excluded.hash, canonical_version=excluded.canonical_version WHERE excluded.updated_at > tickets.updated_at OR (excluded.updated_at = tickets.updated_at AND excluded.hash > tickets.hash);
INSERT INTO tickets (record_id, type, parent_record_id, title, description, status, priority, assigned_to, team, decision_ref, created_at, updated_at, deleted_at, hash, canonical_version) VALUES ('06FBDSKGAHYHH2NPZK8B6EV4D4', 'epic', '06FBDSJYQFDNKP4KA1JAEDSS8W', 'Bundle and resolve pql as a vendored pinned binary', 'Vendor a version-pinned pql binary per shipped platform under native/<platform>/, following the dugite pattern (D-59/D-63): BUILD.md provenance (upstream commit SHA, build command, toolchain, sha256), assets/licenses.yaml entry (D-42/D-65). Add a bundled-first resolver mirroring _resolveDugiteGit() in lib/kernel/src/toolchain_paths.dart: CLIDE_PQL_BIN env override -> binary next to the executable -> system pql on PATH (currently pql is PATH-only via _findOnPath at line 88). SECURITY: resolve against the install dir only, never workspace-relative — a planted ./native/pql is a code-exec vector (the T-98 dugite lesson). Bundled copy must not self-update. Add a soft version-floor check that surfaces an out-of-date override/PATH pql in the Problems panel. Switch CI to run the in-tree binary instead of assuming pql on the runner.', 'backlog', 'medium', NULL, NULL, 'D-92', '2026-06-11 13:36:55', '2026-06-11 13:38:05', NULL, '0df8e53ac69113dab9baa174c0f90ff6', 2) ON CONFLICT(record_id) DO UPDATE SET type=excluded.type, parent_record_id=excluded.parent_record_id, title=excluded.title, description=excluded.description, status=excluded.status, priority=excluded.priority, assigned_to=excluded.assigned_to, team=excluded.team, decision_ref=excluded.decision_ref, updated_at=excluded.updated_at, deleted_at=excluded.deleted_at, hash=excluded.hash, canonical_version=excluded.canonical_version WHERE excluded.updated_at > tickets.updated_at OR (excluded.updated_at = tickets.updated_at AND excluded.hash > tickets.hash);
INSERT INTO tickets (record_id, type, parent_record_id, title, description, status, priority, assigned_to, team, decision_ref, created_at, updated_at, deleted_at, hash, canonical_version) VALUES ('06FBDSM0PRGYR61R0NWYAT9VDC', 'epic', '06FBDSJYQFDNKP4KA1JAEDSS8W', 'Single-directory workspace footprint: relocate IDE state to user scope', 'Move clide''s project-scoped state out of the in-repo .clide/ dir into user scope, keyed by a workspace-path hash (reuse the FNV-1a convention from D-70''s IPC socket path). Affected today: SettingsStore project file (_projectFile -> .clide/settings.yaml in lib/kernel/src/settings.dart) and theme_persistence.dart (project.theme). Provide a one-time migration that relocates an existing .clide/settings.yaml to user scope and removes the dir. Drop .clide/ from the gitignore-at-install set (only .pql/ remains). If shared/committed clide config is ever needed, it goes as clide-owned keys in .pql/config.yaml, not a new dir. Note: the open extension-DB question (governance/questions/process.md Q on .clide/clide.db) now assumes a user-scope DB. Accept D-70''s trade-off: moving/renaming a repo re-keys it and resets personal layout.', 'backlog', 'medium', NULL, NULL, 'D-93', '2026-06-11 13:37:00', '2026-06-11 13:38:13', NULL, 'baf3e0de9a0b61b32d37638267445e1f', 2) ON CONFLICT(record_id) DO UPDATE SET type=excluded.type, parent_record_id=excluded.parent_record_id, title=excluded.title, description=excluded.description, status=excluded.status, priority=excluded.priority, assigned_to=excluded.assigned_to, team=excluded.team, decision_ref=excluded.decision_ref, updated_at=excluded.updated_at, deleted_at=excluded.deleted_at, hash=excluded.hash, canonical_version=excluded.canonical_version WHERE excluded.updated_at > tickets.updated_at OR (excluded.updated_at = tickets.updated_at AND excluded.hash > tickets.hash);
INSERT INTO tickets (record_id, type, parent_record_id, title, description, status, priority, assigned_to, team, decision_ref, created_at, updated_at, deleted_at, hash, canonical_version) VALUES ('06FBDSPECQ0FPKB9SYTD7KZSBM', 'epic', '06FBDSJYQFDNKP4KA1JAEDSS8W', 'Workspace onboarding flow and read-mode degrade', 'Add a first-open, idempotent workspace prep flow that reconciles state (virgin / pql-user / partially-init / fully-init / previously-declined) rather than blindly running pql init. Two ordered gates: (1) non-git folder -> OFFER git init, default NO, with a guard that warns when a parent .git would create a nested repo; or pick another folder. (2) pql provisioning, now that pql ships bundled (T-355): config+index is the mandatory floor (the files/query/ignore engine); the planning layer (decisions/tickets + changelog hooks, D-67) is a CONTEXTUAL opt-in offered at first open of the Decisions/Tickets surface, with disclosure. The modal must disclose everything it writes (.gitignore entries, pql config, and — opt-in only — git hooks). Handle the friction.md gotcha: pql init writes to .git/hooks and ignores an existing core.hooksPath; do not clobber it. Writable repo w/o .pql = invalid-until-init. Unwritable repo (read-only mount / no perms) -> degrade to read mode: file tree + editor + D-79 grep stay live, pql surfaces dark behind a banner (depends on T-358 modes). Remember a decline in user scope keyed by repo path; provide an explicit ''initialize workspace'' command; no re-nagging.', 'backlog', 'medium', NULL, NULL, 'D-95', '2026-06-11 13:37:19', '2026-06-11 13:38:23', NULL, '7508bf6aa6dac26cfef8069f0b305c1b', 2) ON CONFLICT(record_id) DO UPDATE SET type=excluded.type, parent_record_id=excluded.parent_record_id, title=excluded.title, description=excluded.description, status=excluded.status, priority=excluded.priority, assigned_to=excluded.assigned_to, team=excluded.team, decision_ref=excluded.decision_ref, updated_at=excluded.updated_at, deleted_at=excluded.deleted_at, hash=excluded.hash, canonical_version=excluded.canonical_version WHERE excluded.updated_at > tickets.updated_at OR (excluded.updated_at = tickets.updated_at AND excluded.hash > tickets.hash);
INSERT INTO tickets (record_id, type, parent_record_id, title, description, status, priority, assigned_to, team, decision_ref, created_at, updated_at, deleted_at, hash, canonical_version) VALUES ('06FBDSQ2GBSP0ZH4RHZG2PMR0R', 'task', '06FBDSPECQ0FPKB9SYTD7KZSBM', 'Declared extension modes (manifest) + classify builtins as read-mode-safe', 'Introduce a ''modes'' capability in the extension manifest (lib/extension/src/manifest.dart) as an open vocabulary: edit and read now, with remote/ssh/webui reserved (D-94). The extension host (lib/extension/src/host.dart) activates an extension only when the active workspace mode is in its declared set; an undeclared extension defaults to edit-only. Then classify the builtins: read-mode-safe = editor (view), files (tree + D-79 grep), git (status/log/diff viewing), terminal, claude; goes dark = pql (search/query/backlinks), decisions, tickets, graph; partial = problems (keep non-pql diagnostics, drop the pql.doctor row). This is the substrate read-mode degrade (T-357) gates on, and the seam the SSH-remote question (Q-23) is expected to resolve into.', 'backlog', 'medium', NULL, NULL, 'D-94', '2026-06-11 13:37:25', '2026-06-11 13:38:31', NULL, 'ba097febcafc3595656faa9a25b75a41', 2) ON CONFLICT(record_id) DO UPDATE SET type=excluded.type, parent_record_id=excluded.parent_record_id, title=excluded.title, description=excluded.description, status=excluded.status, priority=excluded.priority, assigned_to=excluded.assigned_to, team=excluded.team, decision_ref=excluded.decision_ref, updated_at=excluded.updated_at, deleted_at=excluded.deleted_at, hash=excluded.hash, canonical_version=excluded.canonical_version WHERE excluded.updated_at > tickets.updated_at OR (excluded.updated_at = tickets.updated_at AND excluded.hash > tickets.hash);
INSERT INTO tickets (record_id, type, parent_record_id, title, description, status, priority, assigned_to, team, decision_ref, created_at, updated_at, deleted_at, hash, canonical_version) VALUES ('06FB2T11GCV1EV07DYD5BZENTM', 'story', '06FB0TNQM5TWC00GW0P3X02HZW', 'Live tail sub-card inside expanded Bash activity cards', 'Expanded Bash activity cards should be able to show a live, scrolling tail of a file-backed source the command is following, so the user can watch the same output Claude is tailing — connected lazily, only while the card is expanded.
**Motivation**
Long-running / tailing Bash steps render only a final result block once the command finishes (see screenshot in T-304 thread). The user can''t follow progress. We want an embedded scrolling terminal sub-card inside the expanded activity card for visibility.
**Hard constraint (feasibility, established by investigation)**
Claude Code CLI executes every Bash tool itself; clide only ingests stream-json events (stream_json_session.dart -> parseTranscriptChunk). A tool_result arrives as ONE complete block clide never sees in-flight tool output, and the controller''s in-place upsert path is hardcoded for `partial-<msg_id>` prose deltas, not tool results (controller.dart). We cannot tap Claude''s subprocess fd. So a fully-general "mirror the running command''s stdout" is NOT possible.
**Viable scope: independent file-tail on expand**
- On card expand, parse the Bash command string (AssistantToolUse.input["command"], transcript_reader.dart) for a file-backed source: `tail -f X`, `tail -n N X`, `cat X`, `less X`, known log paths, or a background task writing to a file.
- If found, clide opens its OWN read-only follower a NativePty running `tail -f X` (native_pty.dart already exposes Stream<Uint8List>) or a Dart file-watcher and renders it in an embedded scrolling terminal sub-card, reusing TerminalView.
- Lazy lifecycle: connect on expand, disconnect/dispose on collapse. No connection until expanded.
- Read-only & safe: clide observes the same file; it never re-runs or intercepts Claude''s command.
- Graceful when there is no file-backed source (e.g. `git push ... | tail -25`, a pipe inside Claude''s process): show a muted "no independent source to follow" note rather than faking output.
**Where**
- Card body: conversation_card.dart / conversation_view.dart (_toolUseCollapser, the Bash tool card). Add an optional live-tail segment below the RESULT segment.
- Key the live connection on AssistantToolUse.toolUseId.
- Embedded terminal: reuse lib/src/terminal TerminalView + lib/src/pty NativePty.
**Open questions (settle in review / may need a Q-record)**
- Command-parsing surface: which commands/forms count as "tailable"? Keep it a small, explicit allowlist to avoid mis-following.
- Security: only follow paths inside the workspace? How to handle absolute paths outside the repo.
- Lifecycle when the underlying command has already finished (file static) vs still running.
**Acceptance**
- Expanding a Bash card whose command tails a file shows a live scrolling terminal sub-card that updates as the file grows; collapsing it tears the follower down.
- A Bash card with no file-backed source shows a clear "nothing to follow" affordance, never a broken/empty terminal.
- No follower process is spawned until the card is expanded.', 'in_progress', 'medium', NULL, NULL, NULL, '2026-06-10 12:00:52', '2026-06-11 14:18:34', NULL, 'c987cb650ad845e72e459441e0d72aa9', 2) ON CONFLICT(record_id) DO UPDATE SET type=excluded.type, parent_record_id=excluded.parent_record_id, title=excluded.title, description=excluded.description, status=excluded.status, priority=excluded.priority, assigned_to=excluded.assigned_to, team=excluded.team, decision_ref=excluded.decision_ref, updated_at=excluded.updated_at, deleted_at=excluded.deleted_at, hash=excluded.hash, canonical_version=excluded.canonical_version WHERE excluded.updated_at > tickets.updated_at OR (excluded.updated_at = tickets.updated_at AND excluded.hash > tickets.hash);
INSERT INTO tickets (record_id, type, parent_record_id, title, description, status, priority, assigned_to, team, decision_ref, created_at, updated_at, deleted_at, hash, canonical_version) VALUES ('06FB2T11GCV1EV07DYD5BZENTM', 'story', '06FB0TNQM5TWC00GW0P3X02HZW', 'Live tail sub-card inside expanded Bash activity cards', 'Expanded Bash activity cards should be able to show a live, scrolling tail of a file-backed source the command is following, so the user can watch the same output Claude is tailing — connected lazily, only while the card is expanded.
**Motivation**
Long-running / tailing Bash steps render only a final result block once the command finishes (see screenshot in T-304 thread). The user can''t follow progress. We want an embedded scrolling terminal sub-card inside the expanded activity card for visibility.
**Hard constraint (feasibility, established by investigation)**
Claude Code CLI executes every Bash tool itself; clide only ingests stream-json events (stream_json_session.dart -> parseTranscriptChunk). A tool_result arrives as ONE complete block clide never sees in-flight tool output, and the controller''s in-place upsert path is hardcoded for `partial-<msg_id>` prose deltas, not tool results (controller.dart). We cannot tap Claude''s subprocess fd. So a fully-general "mirror the running command''s stdout" is NOT possible.
**Viable scope: independent file-tail on expand**
- On card expand, parse the Bash command string (AssistantToolUse.input["command"], transcript_reader.dart) for a file-backed source: `tail -f X`, `tail -n N X`, `cat X`, `less X`, known log paths, or a background task writing to a file.
- If found, clide opens its OWN read-only follower a NativePty running `tail -f X` (native_pty.dart already exposes Stream<Uint8List>) or a Dart file-watcher and renders it in an embedded scrolling terminal sub-card, reusing TerminalView.
- Lazy lifecycle: connect on expand, disconnect/dispose on collapse. No connection until expanded.
- Read-only & safe: clide observes the same file; it never re-runs or intercepts Claude''s command.
- Graceful when there is no file-backed source (e.g. `git push ... | tail -25`, a pipe inside Claude''s process): show a muted "no independent source to follow" note rather than faking output.
**Where**
- Card body: conversation_card.dart / conversation_view.dart (_toolUseCollapser, the Bash tool card). Add an optional live-tail segment below the RESULT segment.
- Key the live connection on AssistantToolUse.toolUseId.
- Embedded terminal: reuse lib/src/terminal TerminalView + lib/src/pty NativePty.
**Open questions (settle in review / may need a Q-record)**
- Command-parsing surface: which commands/forms count as "tailable"? Keep it a small, explicit allowlist to avoid mis-following.
- Security: only follow paths inside the workspace? How to handle absolute paths outside the repo.
- Lifecycle when the underlying command has already finished (file static) vs still running.
**Acceptance**
- Expanding a Bash card whose command tails a file shows a live scrolling terminal sub-card that updates as the file grows; collapsing it tears the follower down.
- A Bash card with no file-backed source shows a clear "nothing to follow" affordance, never a broken/empty terminal.
- No follower process is spawned until the card is expanded.', 'in_progress', 'medium', NULL, NULL, NULL, '2026-06-10 12:00:52', '2026-06-11 14:59:53', NULL, '2b485906c225f811862fb5ec97ae37cf', 2) ON CONFLICT(record_id) DO UPDATE SET type=excluded.type, parent_record_id=excluded.parent_record_id, title=excluded.title, description=excluded.description, status=excluded.status, priority=excluded.priority, assigned_to=excluded.assigned_to, team=excluded.team, decision_ref=excluded.decision_ref, updated_at=excluded.updated_at, deleted_at=excluded.deleted_at, hash=excluded.hash, canonical_version=excluded.canonical_version WHERE excluded.updated_at > tickets.updated_at OR (excluded.updated_at = tickets.updated_at AND excluded.hash > tickets.hash);
+4
View File
@@ -133,6 +133,10 @@ You might also want, project-permitting:
- [D-89: inline pasted-image thumbnails that expand to the lightbox](decisions/design.md#d-89-inline-pasted-image-thumbnails-that-expand-to-the-lightbox) — _design_
- [D-90: clide:// deep links — paranoid allowlist + user confirmation](decisions/architecture.md#d-90-clide-deep-links--paranoid-allowlist--user-confirmation) — _architecture_
- [D-91: Unified conversation drawing card backed by a canvas renderer](decisions/architecture.md#d-91-unified-conversation-drawing-card-backed-by-a-canvas-renderer) — _architecture_
- [D-92: Ship pql bundled with clide](decisions/tooling.md#d-92-ship-pql-bundled-with-clide) — _tooling_
- [D-93: clide writes no directories of its own into the workspace](decisions/architecture.md#d-93-clide-writes-no-directories-of-its-own-into-the-workspace) — _architecture_
- [D-94: Workspace mode is a first-class, extensible declared capability](decisions/architecture.md#d-94-workspace-mode-is-a-first-class-extensible-declared-capability) — _architecture_
- [D-95: Workspace validity and onboarding flow](decisions/architecture.md#d-95-workspace-validity-and-onboarding-flow) — _architecture_
## Open questions
+31
View File
@@ -23,6 +23,7 @@ Core, rendering, IPC, kernel, panel manager.
### D-4: Ignore file strategy
- **Date:** 2026-04-20 (was ADR 0004; ported from the claudian lineage)
- **Amendment (2026-06-11):** Per [D-93](#d-93-clide-writes-no-directories-of-its-own-into-the-workspace), clide no longer writes a `.clide/` directory into the repo; only `.pql/` is added to `.gitignore` at install time. The `.clide/` mention below is retained for history.
- **Decision:** One mechanism everywhere: the `ignore_files:` list in `.pql/config.yaml`. Ordered list of gitignore-shaped files; later entries win on per-pattern conflicts. pql defaults to `ignore_files: [.gitignore]`. Per [D-3](#d-3-pql-as-supporter-tool-clide-wraps-never-duplicates), clide writes the list on load — `[.gitignore, .clideignore]` if `.clideignore` exists, else `[.gitignore]`. `.clideignore` carries **only** the clide-specific deviations from `.gitignore` (supports `!pattern` negations); never duplicate gitignore's contents. Walker magic: none except `.git/` — every other tool-owned dir (`.pql/`, `.clide/`) is added to `.gitignore` at install time; exclusion flows through the normal `ignore_files:` chain.
- **Context:** Every file-enumerating surface in clide (pql query panels, canvas drivers, graph view, file watchers, pane lists, file tree) needs to skip the obvious junk — `vendor/`, `node_modules/`, `dist/`, build artifacts — or results drown in noise. Clide's working assumption is that the git repo *is* the workspace — no separate "vault" concept.
- **Rationale:** Users get one config knob, in a file they might already know (pql users) or never need to touch (clide-only users). `.clideignore` is short by design — it's deltas, not a full list. Sidecar consumers read the same key and apply identical precedence, so Claude and the user always see the same filtered surface.
@@ -190,6 +191,7 @@ Core, rendering, IPC, kernel, panel manager.
### D-53: State persistence across sessions
- **Date:** 2026-04-22
- **Amendment (2026-06-11):** Per [D-93](#d-93-clide-writes-no-directories-of-its-own-into-the-workspace), this state moves from in-repo `.clide/settings.yaml` to user-scope storage keyed by workspace-path hash. The `.clide/settings.yaml` references below are retained for history.
- **Decision:** The following layout state is persisted across app restarts: collapse state of left and right panels, active left section (tickets/decisions/files/git/pr), active right context type, pql pane expanded/collapsed, editor split ratio when open, fuzzy find recent picks. Stored via `SettingsStore` in project-scoped settings (`.clide/settings.yaml`).
- **Rationale:** Users expect their workspace layout to survive restarts. Without persistence, every launch starts at the default layout preset, which is disorienting when the user has customised their column widths and panel states.
- **Cost:** Adds write-on-change to several layout operations. Must handle migration if the setting keys evolve. `.clide/settings.yaml` is already gitignored, so personal layout state stays personal.
@@ -469,4 +471,33 @@ Core, rendering, IPC, kernel, panel manager.
- **Relationship:** Narrows [Q-4](../questions/architecture.md#q-4-canvas-schema-compatibility-with-obsidian) — clide's canvas is its own HTML-canvas-inspired JSON; Obsidian `.canvas` is an *import* format via conversion, not the native schema. Consumes the stdin/`--file` JSON input plumbing (T-315). Subsumes the standalone icon card (T-313) and image-annotation work (T-316) as templates of this card. **Merges the former Tier-5 "canvas and graph view" epic (T-7) into one canvas epic (T-317):** the Tier-5 canvas *pane* (T-322, interactive/editable — distinct from the display-only conversation card) and graph *view* (T-323) consume the same shared renderer; T-7 is cancelled as superseded. The conversation drawing card stays display-only per [D-78]; the canvas pane is a full interactive pane. (D-17 "panels are extension-shaped" is unaffected and still governs the panes.)
- **Raised by:** 2026-06-10 — user, while refining the icon-preview card (T-313): "make it all into one drawing card that receives a json input and selects based on the context inside the json what to draw … pull the entire thing closer to a dynamic canvas than a bunch of one-off renderers." Clarified the model is HTML `<canvas>` (not Obsidian's), templates-over-primitives, per-object label/description, and reuse as the `.canvas` renderer; before/after comparisons, SVGs, icons, and graphs all become things you send into the card.
### D-93: clide writes no directories of its own into the workspace
- **Date:** 2026-06-11
- **Decision:** clide-the-IDE contributes **zero** directories to a workspace. The only tool-owned directories physically written into a repo are `.git/` (git's, brought by the user) and `.pql/` (pql's repo data — index + planning changelog). All IDE-local per-workspace state — panel collapse, active sections, split ratios, project theme, recent picks ([D-53](#d-53-state-persistence-across-sessions)), and any future per-repo extension DB — moves to **user scope**, stored outside the repo and keyed by a hash of the workspace path, the same convention the IPC socket already uses ([D-70](#d-70-ipc-socket-path-is-per-workspace-deterministic)). If clide ever needs shared, *committed* per-repo config, it lives as clide-owned keys in `.pql/config.yaml` (the existing `ignore_files:` precedent, [D-3](#d-3-pql-as-supporter-tool-clide-wraps-never-duplicates)/[D-4](#d-4-ignore-file-strategy)) — never a new directory.
- **Context:** clide previously wrote project-scoped settings to an in-repo `.clide/` directory ([D-53](#d-53-state-persistence-across-sessions)). Even gitignored, that put an IDE scratch dir physically inside the user's repo. "Written in the repo" — not "checked in" — is the thing being minimized.
- **Rationale:** One tool dir in the repo (`.pql/`), and it earns its place because it holds data *about* the repo. Personal IDE state is not repo data, so it belongs in user scope — exactly where [D-70](#d-70-ipc-socket-path-is-per-workspace-deterministic) and [D-41](#d-41-claude-panes-one-primary-per-repo-tmux-backed) already keep per-workspace runtime state. Nothing shared is lost: `.clide/settings.yaml` was already gitignored, so it was never committed anyway.
- **Cost:** A one-time migration of any existing in-repo `.clide/settings.yaml` to user scope, then dropping the dir. Per-workspace state inherits [D-70](#d-70-ipc-socket-path-is-per-workspace-deterministic)'s trade-off: moving or renaming a repo re-keys it and resets personal layout.
- **Amends [D-4](#d-4-ignore-file-strategy):** D-4's clause "`.clide/`) is added to `.gitignore` at install time" is moot — clide no longer writes `.clide/` into the repo. Only `.pql/` is added to `.gitignore` at install time.
- **Amends [D-53](#d-53-state-persistence-across-sessions):** persisted layout state moves from in-repo `.clide/settings.yaml` to user-scope storage keyed by workspace-path hash.
- **Cross-reference:** [D-3](#d-3-pql-as-supporter-tool-clide-wraps-never-duplicates), [D-4](#d-4-ignore-file-strategy), [D-53](#d-53-state-persistence-across-sessions), [D-70](#d-70-ipc-socket-path-is-per-workspace-deterministic), [D-41](#d-41-claude-panes-one-primary-per-repo-tmux-backed).
- **Raised by:** 2026-06-11 — user: "I am not a fan of IDEs tossing in multiple dirs … only the pql dir which contains repo data gets [written] in repo."
### D-94: Workspace mode is a first-class, extensible declared capability
- **Date:** 2026-06-11
- **Decision:** A clide workspace runs in exactly one **mode** at a time, drawn from an open, extensible vocabulary — initially `edit` (full local read/write; the default) and `read` (read-only; no writable `.pql/`), with `remote`, `ssh`, and `webui` reserved as future values. Every extension declares the modes it supports in its manifest (`modes: [edit, read]`); an extension with no declaration is assumed `edit`-only. The extension host activates an extension only when the active workspace mode is in its declared set — unsupported extensions stay dormant. New modes are added as new vocabulary values **without schema changes**; the open SSH-remote question ([Q-23](../questions/architecture.md#q-23-ssh-remote-development--run-clide-against-a-remote-workspace)) is expected to resolve *into* a mode value, not a parallel mechanism.
- **Context:** Read-mode degrade ([D-95](#d-95-workspace-validity-and-onboarding-flow)) needs to know which extensions remain functional without pql and without write access. A boolean `read_mode_safe` would answer only today's question and would not compose with the `remote`/`ssh`/`webui` modes already on the horizon.
- **Rationale:** Modelling capability as a declared mode set is uniform and future-proof — one mechanism the host gates on, one place extensions opt in, and third-party extensions participate by declaring. Reserving the future values now means remote/ssh/webui work plugs into an existing seam instead of inventing its own.
- **Cost:** Every builtin extension must declare its modes (a one-time classification pass); the host gains mode-gating logic; the vocabulary is open-ended and must stay coherent as values accrue. Defaulting an undeclared extension to `edit`-only is conservative but may surprise authors.
- **Cross-reference:** [D-17](extensions.md#d-17-panels-are-extension-shaped-from-day-one), [D-95](#d-95-workspace-validity-and-onboarding-flow), [Q-23](../questions/architecture.md#q-23-ssh-remote-development--run-clide-against-a-remote-workspace).
- **Raised by:** 2026-06-11 — user: "read_mode_safe: true is not leaving space for further modes (ssh mode, remote mode, webui mode, read mode, edit mode). Prepare it for that."
### D-95: Workspace validity and onboarding flow
- **Date:** 2026-06-11
- **Decision:** A clide workspace is valid only when it is a git repo with an initialized `.pql/`. Two consequences. **(1) Git is a precondition the user owns.** clide never auto-runs `git init`; opening a non-git folder *offers* initialization (**default no**, with a guard that warns when a parent `.git` would make this a nested repo) or lets the user pick another folder. **(2) pql is clide-provisioned.** Because pql now ships bundled ([D-92](tooling.md#d-92-ship-pql-bundled-with-clide)), an uninitialized repo triggers a **required, idempotent** prep flow that reconciles state (virgin / pql-user / partially-init / fully-init / previously-declined) and **discloses exactly what it writes**`.gitignore` entries for `.pql/`, pql's config, and (only on opt-in) git hooks. The mandatory floor is pql **config + index** (the files/query/ignore engine); the **planning layer** (decisions/tickets + the changelog hooks of [D-67](process.md#d-67-pql-changelog-files-are-committed-alongside-code), which alter the user's git workflow) is a **contextual opt-in** offered when the user first opens the Decisions or Tickets surface — never forced at onboarding. A writable repo with no `.pql/` is *invalid-until-initialized*; a repo clide **cannot** write (read-only mount, no permission) degrades to **read mode** ([D-94](#d-94-workspace-mode-is-a-first-class-extensible-declared-capability)) — file tree, editor, and the pure-Dart content search ([D-79](#d-79-workspace-content-search-is-a-pure-dart-in-process-engine-outside-pql)) stay live; pql-backed surfaces go dark behind a clear banner. A decline is remembered in user scope, keyed by repo path; clide does not re-nag, and an explicit "initialize workspace" command is always available.
- **Context:** [D-4](#d-4-ignore-file-strategy) already specified that `.pql/` is "added to `.gitignore` at install time" — presuming an install-time event that never had a trigger. Bundling pql ([D-92](tooling.md#d-92-ship-pql-bundled-with-clide)) is what makes "pql required" honest: clide can always provide the means to create `.pql/`. This record is that missing trigger.
- **Rationale:** pql is clide's core query/ignore engine, not just the ticket board, so a repo without it is degraded for *core editing*, not only planning — gating on `.pql/` is truthful. Git, by contrast, is a foundational, identity-level user decision (and `git init` in the wrong place is a footgun), so clide offers but never imposes it. Splitting the mandatory config+index from the opt-in planning hooks keeps the invasive git-workflow change consensual and contextual. Read-mode degrade keeps clide usable as an editor on repos it cannot write — consistent with [D-80](#d-80-filesread-allows-trusted-claude-config-roots-beyond-the-workspace)'s read appetite — instead of refusing them outright.
- **Cost:** An onboarding/state-reconciliation flow with a disclosing modal. The installer must handle the known hooks gotcha (`pql init` writes to `.git/hooks` and ignores an existing `core.hooksPath`) — it must not silently clobber a repo that sets `core.hooksPath`. The read-mode path gates extensions by their declared modes ([D-94](#d-94-workspace-mode-is-a-first-class-extensible-declared-capability)) and must provide graceful fallbacks where pql surfaces go dark.
- **Cross-reference:** [D-3](#d-3-pql-as-supporter-tool-clide-wraps-never-duplicates), [D-4](#d-4-ignore-file-strategy), [D-67](process.md#d-67-pql-changelog-files-are-committed-alongside-code), [D-79](#d-79-workspace-content-search-is-a-pure-dart-in-process-engine-outside-pql), [D-80](#d-80-filesread-allows-trusted-claude-config-roots-beyond-the-workspace), [D-92](tooling.md#d-92-ship-pql-bundled-with-clide), [D-94](#d-94-workspace-mode-is-a-first-class-extensible-declared-capability).
- **Raised by:** 2026-06-11 — user, this planning session: a repo without `.pql/` is "invalid for clide"; non-git folder → "offer default no"; planning hooks contextual; unwritable repos degrade.
---
+9
View File
@@ -91,4 +91,13 @@ Toolchain, supply chain, CI, ignore strategy.
- **Cross-reference:** [D-31](#d-31-prefer-zero-deps-exact-pin), [D-42](#d-42-dependencies-documented-in-licensesyaml), [D-61](#d-61-dependency-vetting-checklist), `POLICY.md`.
- **Raised by:** 2026-04-26 policy-to-decision migration (T-28).
### D-92: Ship pql bundled with clide
- **Date:** 2026-06-11
- **Decision:** clide ships `pql` as a vendored, version-pinned native binary — the same model used for git via dugite ([D-59](#d-59-bundled-git-via-dugite-native)). The pinned binary lives under `native/<platform>/` with a `BUILD.md` provenance record ([D-63](#d-63-vendored-binary-rebuild-process)) and an `assets/licenses.yaml` entry ([D-42](#d-42-dependencies-documented-in-licensesyaml), [D-65](#d-65-license-compatibility-matrix)). Resolution order is: `CLIDE_PQL_BIN` env override (dev escape hatch — e.g. pointing at a pql built side-by-side) → bundled binary resolved against the **install directory** (next to the executable, never workspace-relative) → system `pql` on PATH. The bundled copy never self-updates — the pin is the contract, so `pql self-update` is inert for it. A version floor is enforced *softly*: if the resolved pql (override or PATH) is older than the pinned floor, the Problems panel surfaces it rather than clide silently mis-driving an incompatible binary. CI runs the in-tree binary instead of provisioning pql on the runner.
- **Context:** pql is clide's files/query/ignore engine **and** its planning engine ([D-3](architecture.md#d-3-pql-as-supporter-tool-clide-wraps-never-duplicates)), yet it was an unmanaged external dependency: users installed and updated it themselves, with no version pin. Beyond the "update the binary, then install it" friction, an old PATH pql replaying the changelog ([D-67](process.md#d-67-pql-changelog-files-are-committed-alongside-code)) is a latent *corruption* risk, not merely a missing-feature one. This is a distribution gap, not an architecture one.
- **Rationale:** Bundling makes a fresh clone/install work with zero separate pql setup, pins the version clide was tested against (closing the changelog-schema-skew risk), and reuses the proven dugite pattern and its supply-chain gates ([D-60](#d-60-no-network-on-default-launch-path)/[D-61](#d-61-dependency-vetting-checklist)/[D-63](#d-63-vendored-binary-rebuild-process)). It is **additive, not a fork**: pql stays a standalone tool, clide still wraps and never reimplements ([D-3](architecture.md#d-3-pql-as-supporter-tool-clide-wraps-never-duplicates)), and pql's universality for terminal/VS Code users is untouched. pql being a pure-Go, no-CGo static binary makes per-platform bundling cheap.
- **Cost:** A pinned binary per shipped platform (linux-x64 now; macOS arm64/x64 when those builds land), each carried through the [D-63](#d-63-vendored-binary-rebuild-process) rebuild ritual on every pql release — the same bump cadence as dugite and tree-sitter. Resolving the bundled binary against the install dir and **never** a workspace-relative path is mandatory: a repo could otherwise plant `native/pql` and gain code execution (the T-98 dugite lesson).
- **Cross-reference:** [D-3](architecture.md#d-3-pql-as-supporter-tool-clide-wraps-never-duplicates), [D-59](#d-59-bundled-git-via-dugite-native), [D-60](#d-60-no-network-on-default-launch-path), [D-61](#d-61-dependency-vetting-checklist), [D-63](#d-63-vendored-binary-rebuild-process), [D-42](#d-42-dependencies-documented-in-licensesyaml), [D-65](#d-65-license-compatibility-matrix), [D-67](process.md#d-67-pql-changelog-files-are-committed-alongside-code).
- **Raised by:** 2026-06-11 — user: "pql updates live outside this repo and people have to first update the pql binaries and install them."
---
@@ -0,0 +1,119 @@
/// Detect the file a Bash command follows, for the live-tail sub-card (T-325).
///
/// Claude Code runs every Bash tool itself and clide only sees the final
/// `tool_result` block — we never tap the running command's stdout. So instead
/// of mirroring the process, we detect a *file-backed source* the command
/// reads/follows and open our own read-only follower on the same file.
///
/// Deliberately conservative (the ticket's "small, explicit allowlist"): only
/// the read/follow verbs below, only a single file argument, and only paths
/// that resolve INSIDE the workspace. Anything else — a pipe into `tail`, a
/// redirect, two files, a path outside the repo — returns null so the caller
/// shows a "nothing to follow" affordance instead of following the wrong thing.
library;
import 'dart:io';
import 'package:clide/src/files/path_safety.dart';
/// Verbs whose single file argument clide can independently follow read-only.
const Set<String> _followVerbs = {'tail', 'cat', 'less'};
/// The file [command] reads/follows that clide can mirror read-only, as an
/// absolute path inside [workspaceRoot] — or null when there is no single,
/// safe, file-backed source. See the library doc for the policy.
String? detectBashTailSource(String command, {required Directory workspaceRoot}) {
String? found;
for (final segment in _commandSegments(command)) {
final tokens = _tokenize(segment);
if (tokens.isEmpty || !_followVerbs.contains(tokens.first)) continue;
final files = _fileArgs(tokens.first, tokens.sublist(1));
if (files.length != 1) continue; // 0 → reads stdin (a pipe); >1 → ambiguous
final String resolved;
try {
resolved = resolveUnderRoot(workspaceRoot, files.single);
} on PathOutsideRoot {
continue; // outside the workspace → don't follow (v1 policy)
}
if (found != null && found != resolved) return null; // two distinct sources
found = resolved;
}
return found;
}
/// Whether [command] expresses an intent to FOLLOW a file — used to decide
/// when to surface the live-tail segment at all, so ordinary commands (`ls`,
/// `git status`, a plain `cat`) get no segment, but a `tail …` with no
/// followable file still shows the "nothing to follow" note. v1 triggers on
/// `tail` or a follow flag (`-f`/`-F`/`--follow`); `cat`/`less` are detectable
/// sources but don't trigger the UI on their own (T-325).
bool bashHasTailIntent(String command) {
for (final segment in _commandSegments(command)) {
final tokens = _tokenize(segment);
if (tokens.isEmpty) continue;
if (tokens.first == 'tail') return true;
if (tokens.any((t) => t == '-f' || t == '-F' || t == '--follow')) return true;
}
return false;
}
/// Split a command line into command/pipeline segments on `|`, `;`, `&`. The
/// doubled forms (`&&`, `||`) fall out as empty middles and are dropped.
Iterable<String> _commandSegments(String command) => command.split(RegExp(r'[|;&]')).where((s) => s.trim().isNotEmpty);
/// Positional (non-flag) file arguments for [verb]. Skips flags, consumes the
/// value of `tail -n N` / `-c N`, honours `--` (end of options), and stops at a
/// redirect (`>` / `<`) — everything after a redirect targets a fd, not the
/// command's input.
List<String> _fileArgs(String verb, List<String> args) {
final files = <String>[];
for (var i = 0; i < args.length; i++) {
final a = args[i];
if (a == '--') {
files.addAll(args.sublist(i + 1).where((t) => !t.contains('>') && !t.contains('<')));
break;
}
if (a.contains('>') || a.contains('<')) break; // a redirect ends positional args
if (a.startsWith('-')) {
if (verb == 'tail' && (a == '-n' || a == '-c') && i + 1 < args.length) i++; // -n N / -c N
continue;
}
files.add(a);
}
return files;
}
/// Minimal shell tokeniser: splits on whitespace, honours single/double quotes
/// (no escape or expansion handling — enough to recover file arguments).
List<String> _tokenize(String s) {
final out = <String>[];
final buf = StringBuffer();
String? quote;
var has = false;
for (var i = 0; i < s.length; i++) {
final ch = s[i];
if (quote != null) {
if (ch == quote) {
quote = null;
} else {
buf.write(ch);
}
has = true;
} else if (ch == '"' || ch == "'") {
quote = ch;
has = true;
} else if (ch == ' ' || ch == '\t') {
if (has) {
out.add(buf.toString());
buf.clear();
has = false;
}
} else {
buf.write(ch);
has = true;
}
}
if (has) out.add(buf.toString());
return out;
}
@@ -0,0 +1,80 @@
/// Read-only file follower for the Bash live-tail sub-card (T-325).
///
/// clide can't see a running Bash command's stdout (Claude Code owns the
/// process), so to "watch the same output" we open our OWN read-only follower
/// on the file the command tails. This never spawns a process and never
/// touches Claude's command — it just reads the file as it grows, like
/// `tail -f`, and hands new bytes to [onData].
///
/// Pure dart:io/dart:async (no Flutter) so it's unit-testable. Polls rather
/// than using a watcher so it works uniformly across platforms and survives
/// truncation/rotation (size shrinking → re-read from the top).
library;
import 'dart:async';
import 'dart:io';
import 'dart:typed_data';
class FileTailFollower {
FileTailFollower(this.path, {required this.onData, this.tailBytes = 16384, this.interval = const Duration(milliseconds: 300)});
/// Absolute path of the file to follow.
final String path;
/// New bytes appended since the last read (or the initial tail window).
final void Function(Uint8List bytes) onData;
/// On first read, start this many bytes from the end (a `tail -c` window)
/// rather than dumping the whole file.
final int tailBytes;
final Duration interval;
int _pos = 0;
bool _primed = false;
bool _stopped = false;
Timer? _timer;
/// Begin following: emit the initial tail window, then poll for growth.
Future<void> start() async {
await pollOnce();
if (_stopped) return;
_timer = Timer.periodic(interval, (_) => pollOnce());
}
/// One read cycle. Public so tests can drive it deterministically without
/// waiting on the timer. Reads any bytes appended since the last position
/// (or, on the first call, the trailing [tailBytes]); resets to the top if
/// the file shrank (truncated/rotated).
Future<void> pollOnce() async {
if (_stopped) return;
final file = File(path);
if (!await file.exists()) return; // not created yet — keep waiting
final length = await file.length();
if (!_primed) {
_pos = length > tailBytes ? length - tailBytes : 0;
_primed = true;
} else if (length < _pos) {
_pos = 0; // truncated / rotated → re-read from the top
}
if (length <= _pos) return;
final raf = await file.open();
try {
await raf.setPosition(_pos);
final bytes = await raf.read(length - _pos);
_pos = length;
if (!_stopped && bytes.isNotEmpty) onData(Uint8List.fromList(bytes));
} finally {
await raf.close();
}
}
/// Stop following and release the timer. Idempotent.
void stop() {
_stopped = true;
_timer?.cancel();
_timer = null;
}
}
@@ -0,0 +1,112 @@
/// Unit tests for the Bash live-tail source parser (T-325).
library;
import 'dart:io';
import 'package:clide/builtin/claude/src/bash_tail_source.dart';
import 'package:test/test.dart';
void main() {
// resolveUnderRoot is pure string normalisation — the dir need not exist.
final root = Directory('/repo');
String? detect(String cmd) => detectBashTailSource(cmd, workspaceRoot: root);
group('detectBashTailSource — followable file sources (T-325)', () {
test('tail -f a relative file', () {
expect(detect('tail -f app.log'), '/repo/app.log');
});
test('tail -f a nested file', () {
expect(detect('tail -f logs/build.log'), '/repo/logs/build.log');
});
test('tail with -n N before the file', () {
expect(detect('tail -n 200 -f logs/build.log'), '/repo/logs/build.log');
});
test('tail -F (retry-follow)', () {
expect(detect('tail -F server.log'), '/repo/server.log');
});
test('cat a file', () {
expect(detect('cat notes.txt'), '/repo/notes.txt');
});
test('less a file', () {
expect(detect('less README.md'), '/repo/README.md');
});
test('an absolute path INSIDE the workspace is followed', () {
expect(detect('tail -f /repo/sub/x.log'), '/repo/sub/x.log');
});
test('a quoted path with a space', () {
expect(detect('cat "my file.log"'), '/repo/my file.log');
});
test('a redirect after the file is ignored', () {
expect(detect('tail -f app.log 2>/dev/null'), '/repo/app.log');
});
test('a downstream pipe stage is ignored; the tail still has its file', () {
expect(detect('tail -f logs/app.log | grep ERROR'), '/repo/logs/app.log');
});
test('two segments naming the SAME file resolve to one source', () {
expect(detect('cat a.txt && tail -f a.txt'), '/repo/a.txt');
});
});
group('detectBashTailSource — no followable source (T-325)', () {
test('a pipe INTO tail (reads stdin, no file)', () {
expect(detect('git push origin main | tail -25'), isNull);
});
test('tail -f reading a pipe (no file arg)', () {
expect(detect('cmd | tail -f'), isNull);
});
test('a non-follow command', () {
expect(detect('echo hi'), isNull);
});
test('an absolute path OUTSIDE the workspace', () {
expect(detect('tail -f /etc/passwd'), isNull);
});
test('a traversal escaping the workspace', () {
expect(detect('tail -f ../secrets.txt'), isNull);
});
test('two distinct files are ambiguous', () {
expect(detect('tail -f a.log b.log'), isNull);
});
test('two segments naming DIFFERENT files are ambiguous', () {
expect(detect('cat a.txt && tail -f b.txt'), isNull);
});
test('empty command', () {
expect(detect(''), isNull);
});
});
group('bashHasTailIntent — when to surface the segment (T-325)', () {
test('a tail command has tail intent (even into a pipe → "nothing to follow")', () {
expect(bashHasTailIntent('tail -f app.log'), isTrue);
expect(bashHasTailIntent('tail -100 app.log'), isTrue);
expect(bashHasTailIntent('git push | tail -25'), isTrue);
});
test('a bare follow flag counts', () {
expect(bashHasTailIntent('some-cmd --follow build.log'), isTrue);
});
test('ordinary commands have no tail intent (no segment)', () {
expect(bashHasTailIntent('ls -la'), isFalse);
expect(bashHasTailIntent('git status'), isFalse);
expect(bashHasTailIntent('cat README.md'), isFalse); // cat is detectable but not a v1 trigger
expect(bashHasTailIntent('grep -rn foo lib/'), isFalse);
});
});
}
@@ -0,0 +1,75 @@
/// Unit tests for the read-only file tail follower (T-325).
library;
import 'dart:convert';
import 'dart:io';
import 'package:clide/builtin/claude/src/file_tail_follower.dart';
import 'package:test/test.dart';
void main() {
late Directory dir;
late File file;
late List<String> chunks;
FileTailFollower follower(File f) => FileTailFollower(f.path, tailBytes: 8, onData: (b) => chunks.add(utf8.decode(b)));
setUp(() async {
dir = await Directory.systemTemp.createTemp('clide-tail-test-');
file = File('${dir.path}/app.log');
chunks = [];
});
tearDown(() async => dir.existsSync() ? dir.delete(recursive: true) : null);
test('emits the trailing window on the first read, not the whole file', () async {
file.writeAsStringSync('0123456789ABCDEF'); // 16 bytes, tailBytes=8
final f = follower(file);
await f.pollOnce();
expect(chunks, ['89ABCDEF']); // last 8 bytes only
f.stop();
});
test('emits only newly-appended bytes on subsequent reads', () async {
file.writeAsStringSync('start');
final f = follower(file);
await f.pollOnce(); // primes at the tail
chunks.clear();
file.writeAsStringSync(' MORE', mode: FileMode.append);
await f.pollOnce();
expect(chunks, [' MORE']); // only the appended delta
f.stop();
});
test('a missing file is tolerated until it appears', () async {
final f = follower(File('${dir.path}/not-yet.log'));
await f.pollOnce(); // no file → no emit, no throw
expect(chunks, isEmpty);
f.stop();
});
test('truncation/rotation re-reads from the top', () async {
file.writeAsStringSync('aaaaaaaaaaaa'); // 12 bytes
final f = follower(file);
await f.pollOnce();
chunks.clear();
file.writeAsStringSync('XY'); // shrink to 2 bytes (rotated)
await f.pollOnce();
expect(chunks, ['XY']);
f.stop();
});
test('start() emits the initial window and arms the poll', () async {
file.writeAsStringSync('hello world'); // 11 bytes, tailBytes=8
final f = follower(file);
await f.start(); // awaits the initial pollOnce before arming the timer
f.stop(); // tear the timer down before it fires
expect(chunks, ['lo world']); // last 8 bytes
});
test('stop() makes further polls no-ops', () async {
file.writeAsStringSync('hello');
final f = follower(file);
f.stop();
await f.pollOnce();
expect(chunks, isEmpty);
});
}