Skip to content

Feat/ctx desktop#110

Draft
hamzaerbay wants to merge 15 commits into
mainfrom
feat/ctx-desktop
Draft

Feat/ctx desktop#110
hamzaerbay wants to merge 15 commits into
mainfrom
feat/ctx-desktop

Conversation

@hamzaerbay
Copy link
Copy Markdown
Collaborator

Summary

Adds ctx Desktop (ctx-desktop/), a cross-platform desktop GUI client for ctx — a calm, local-first window into a project's persistent AI context. It is a thin client over the ctx CLI: every read/write shells out to ctx, so .context/ stays the source of truth. Stack: Tauri 2 + React + TypeScript + Tailwind v4.

Screens (P0)

  • Overview — task/decision/learning counts + context file/token totals
  • Tasks — list, status filter, inline add (with target section), one-click complete
  • Decisions — searchable browse + three-field ADR authoring form
  • Learnings — searchable browse + authoring
  • Context Packet — budget slider re-running ctx agent --format json, live preview with per-section included/dropped, copy packet / copy command
  • Journal — session timeline (verbatim from ctx journal source)
  • Health — every ctx doctor check with guided fixes (inspect drift, ctx drift --fix, ctx compact --archive) behind a confirm

Platform

  • Workspace switcher — pick a root; depth-bounded Rust scan finds every .context/ project and fills a dropdown
  • fs-watch — auto-refreshes screens on external CLI/agent writes
  • doctor health pill in the top bar (click-through to Health)

Architecture

  • All ctx access funnels through src-tauri/src/ctx_adapter.rs (Rust) + src/adapter/ctx.ts (TS).
  • Spawns ctx via std::process::Command (no shell plugin); writes synthesize provenance (--session-id, --branch/--commit from git).
  • discover.rs (workspace scan, unit-tested) and watcher.rs (fs-watch via notify).

Dependency note

List/count views call ctx <artifact> list --json (added on feat/ctx-artifact-list-json, not yet released). Authoring, Context Packet, Journal, and Health work on stock ctx 0.8.1.

Docs & spec

  • Build/run: ctx-desktop/README.md · Design spec: specs/ctx-desktop.md

Test plan

  • cd ctx-desktop && npm install && npm run tauri dev launches
  • Workspace… scans and the dropdown switches projects
  • Add + complete a task; add a decision and a learning
  • Context Packet slider updates preview; copy actions work
  • Health runs drift/compact fixes
  • With list --json ctx installed, list/count views populate

hamzaerbay added 15 commits May 31, 2026 09:11
Tauri 2 + React + TS + Tailwind v4 in ctx-desktop/. Rust adapter
shells out to ctx via std::process::Command (no shell plugin);
TS adapter mirrors the CLI JSON schemas. Overview screen detects
the ctx binary and shows live task/decision/learning counts plus
status totals, degrading gracefully when a command is missing.

Run: cd ctx-desktop && npm install && npm run tauri dev

Spec: specs/ctx-desktop.md

Signed-off-by: hamzaerbay <hamzaerbay@gmail.com>
Left-nav routing with a shared project path/version top bar.
Tasks screen lists entries with status filter, inline add
(ctx task add, provenance synthesized from git in the Rust
adapter), and one-click complete. Overview now takes the dir
as a prop from the shell.

Spec: specs/ctx-desktop.md

Signed-off-by: hamzaerbay <hamzaerbay@gmail.com>
Searchable list of decisions with expandable context/rationale/
consequence, plus a three-field authoring form wired to
ctx decision add (provenance synthesized from git). Registered
the decisions view in the nav shell.

Spec: specs/ctx-desktop.md

Signed-off-by: hamzaerbay <hamzaerbay@gmail.com>
Searchable list of learnings with expandable context/lesson/
application, plus a quick-add form wired to ctx learning add
(provenance synthesized from git). Registered in the nav shell.

Spec: specs/ctx-desktop.md

Signed-off-by: hamzaerbay <hamzaerbay@gmail.com>
The differentiator: a debounced budget slider re-runs ctx agent
--format json, with a used/budget bar and per-section
included/dropped affordance. Copy packet (markdown via
ctx agent --budget N) and copy command actions.

Spec: specs/ctx-desktop.md

Signed-off-by: hamzaerbay <hamzaerbay@gmail.com>
Journal screen renders ctx journal source verbatim (no journal
JSON mode upstream yet) with a limit selector. Top bar gains a
doctor health pill (ok/warn/error from ctx doctor --json) that
tracks the active project.

Spec: specs/ctx-desktop.md

Signed-off-by: hamzaerbay <hamzaerbay@gmail.com>
Top bar gains a native folder picker (tauri-plugin-dialog) and a
recent-projects dropdown persisted in localStorage. Selecting or
picking a project repoints every screen and the health pill.

Spec: specs/ctx-desktop.md

Signed-off-by: hamzaerbay <hamzaerbay@gmail.com>
Rust watcher (notify) on the active <dir>/.context emits a
ctx-changed event; a debounced frontend hook bumps a reload key
that every screen depends on. The GUI is one writer among several
(human CLI + AI agents) and no longer shows stale state.

Completes the P0 GUI surface.

Spec: specs/ctx-desktop.md

Signed-off-by: hamzaerbay <hamzaerbay@gmail.com>
Two decisions (std::process::Command over tauri-plugin-shell;
journal rendered verbatim pending journal --json) and two
learnings (Tauri 2 needs rustc >= 1.88; macOS GUI PATH must be
augmented to find a user-installed ctx).

Spec: specs/ctx-desktop.md

Signed-off-by: hamzaerbay <hamzaerbay@gmail.com>
Choose a workspace folder; a depth-bounded Rust walk
(discover_projects, skips node_modules/target/.git, caps at 200)
finds every dir with a .context/ and populates a project
dropdown. Switching repoints all screens, the health pill, and
the watcher. Workspace + active project persist in localStorage;
the manual path field stays as a fallback. Unit-tested.

Spec: specs/ctx-desktop.md

Signed-off-by: hamzaerbay <hamzaerbay@gmail.com>
The workspace switcher supersedes the manual path input + Open
button, so they are removed. Project dropdown and Workspace button
share a uniform h-8 height, with a spacer pushing the health and
version pills to the right.

Spec: specs/ctx-desktop.md

Signed-off-by: hamzaerbay <hamzaerbay@gmail.com>
Projects with Phase sections require ctx task add --section. The
Tasks form now has a section field (datalist of existing
sections, defaults to Misc) and passes it through, fixing the
"task requires --section flag" error. Section persists across
adds for batch entry into one phase.

Spec: specs/ctx-desktop.md

Signed-off-by: hamzaerbay <hamzaerbay@gmail.com>
Complete now passes the task's 1-based pending-order number
(computed locally to match ctx) instead of its text, fixing the
"multiple tasks match" error on duplicate-text tasks. The doctor
pill gains a hover tooltip listing the actual warning/error
messages (filtered to warning/error, matching the count).

Spec: specs/ctx-desktop.md

Signed-off-by: hamzaerbay <hamzaerbay@gmail.com>
New Health screen lists every ctx doctor check, highlights
warnings/errors, and offers guided fixes: inspect drift, auto-fix
drift (ctx drift --fix), and compact/archive (ctx compact
--archive) behind an inline confirm, with command output shown.
The top-bar doctor pill is now clickable through to it.

Spec: specs/ctx-desktop.md

Signed-off-by: hamzaerbay <hamzaerbay@gmail.com>
Replace the Tauri stub README with prerequisites, setup, dev and
production build commands, the ctx list --json CLI dependency,
architecture overview, and troubleshooting notes.

Spec: specs/ctx-desktop.md

Signed-off-by: hamzaerbay <hamzaerbay@gmail.com>
hamzaerbay added a commit to hamzaerbay/ctx that referenced this pull request May 31, 2026
…ktop tasks

Capture the 7 confirmed findings from the security/performance/
scalability review of ctx Desktop as actionable tasks so the
follow-up work survives across sessions. Two merge-blockers
(argument injection via missing -- separator, hardcoded personal
DEFAULT_DIR) plus CSP hardening and four caching/watcher efficiency
items.

Spec: specs/ctx-desktop.md
Signed-off-by: hamzaerbay <hamzaerbay@gmail.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant