Skip to content

llm-workspace dev tooling: skills, tui-qa agent, sparse-read design doc - #13636

Closed
vito wants to merge 53 commits into
llm-workspace-llm-bindingfrom
llm-workspace-dev-tooling
Closed

vito wants to merge 53 commits into
llm-workspace-llm-bindingfrom
llm-workspace-dev-tooling

Conversation

@vito

@vito vito commented Jul 13, 2026 •

Copy link
Copy Markdown
Contributor

Note

Stack 5/5, stacked on #13600 — each PR is based on the one below it, so the diff shows only this PR's own changes. Merge bottom-up; when a PR below merges and its branch is deleted, GitHub retargets this one automatically and the rest of the stack gets rebased.

  1. Engine & TUI fixes: clientdb writes, dagql fan-out, high-verbosity traces #13632 — Engine & TUI fixes
  2. Workspace file APIs: glob and search #13633 — Workspace file APIs: glob and search
  3. LLM foundation: providers, config, session CLI, and TUI #13634 — LLM foundation: providers, config, session CLI, and TUI
  4. LLM ⇄ Workspace: object tools and Env removal #13635 — LLM ⇄ Workspace: object tools, Env removal, and @agent plugins
  5. llm-workspace dev tooling: skills, tui-qa agent, sparse-read design doc #13636 — llm-workspace dev tooling 👈 this PR

Development tooling that grew alongside the llm-workspace work:

  • docs(skills): add tui-surfacing, extend tui-qa
  • skills: add dagger-llm-workspace development skill
  • add tui-qa agent module
  • docs(design): add overlay sparse-read design doc (plus a markdownlint fix)

🤖 Generated with Claude Code

@vito
vito changed the base branch from llm-workspace-llm-binding to main July 13, 2026 21:21
@vito
vito force-pushed the llm-workspace-dev-tooling branch from 0590372 to 2372e0e Compare July 13, 2026 21:27
@vito
vito changed the base branch from main to llm-workspace-llm-binding July 13, 2026 21:35
@vito
vito force-pushed the llm-workspace-llm-binding branch from 4183bac to 1fd56dc Compare July 13, 2026 21:57
@vito
vito force-pushed the llm-workspace-dev-tooling branch from 2372e0e to 9405d9b Compare July 13, 2026 21:57
@vito
vito force-pushed the llm-workspace-llm-binding branch from 1fd56dc to 11c2787 Compare July 14, 2026 19:22
@vito
vito force-pushed the llm-workspace-dev-tooling branch 2 times, most recently from e43b621 to 9b5d2da Compare July 14, 2026 19:39
@vito
vito force-pushed the llm-workspace-llm-binding branch from 6ed219d to e197067 Compare July 14, 2026 20:01
@vito
vito force-pushed the llm-workspace-dev-tooling branch 2 times, most recently from b03510a to 4c4c366 Compare July 14, 2026 21:11
@vito
vito force-pushed the llm-workspace-llm-binding branch 7 times, most recently from bc3a422 to e2ade68 Compare July 17, 2026 00:25
vito added 8 commits July 17, 2026 17:07
Add LLM.withWorkspace/workspace so the LLM operates on the same Workspace
a user sees from the CLI, and remove the prompt input/output bindings
(inputs/outputs, Save, DeclareOutput, and $VAR expansion) that the
workspace model supersedes. Workspace!-typed tool args now auto-fill from
the bound workspace, mirroring the CLI's own tool set.

This is the first step toward eliminating Env: the LLM's tools and
mutable state derive from a Workspace rather than the Env I/O bag.

Signed-off-by: Alex Suraci <[email protected]>
Resolve a module function's context (the +defaultPath Directory and the
tool-dispatch originator) from the bound Workspace rather than Env. Adds
WorkspaceToContext/WorkspaceFromContext and a Workspace-first branch in
LoadContextDir, anchoring contextual paths at the workspace root.

Additive and inert unless a workspace is bound; another step in moving
the LLM's ambient context off Env.

Signed-off-by: Alex Suraci <[email protected]>
The LLM acts through the methods of the objects it's bound to via
LLM.withTools: each eligible method becomes a tool, a method that returns
the bound object's own type rebinds it as the new state, and a Changeset
return applies to the bound workspace. Host-writing fields are blocked
from the model, module entrypoints are surfaced as the way in, and the
schema the model sees derives from the workspace it's bound to.

This replaces the per-field MCP tool surface, and with the workspace
binding in place the Env type loses its last responsibility: Env, its
schema, and its prompt I/O machinery are deleted.

Signed-off-by: Alex Suraci <[email protected]>
Add Query.currentNode, returning the object that received the current
module function call as the universal Node interface. It reads the
receiver threaded onto the active FunctionCall (ModuleFunction.Call now
records it on FunctionCall.parentTyped), which rides the existing
per-session fnCall channel into the module's nested client, so a module
can reference itself without reconstructing a fresh instance.

To let a statically typed caller pass that Node where an object is
wanted, LLM.withTools's object argument now carries
@expectedType(name: "Node"): every object implements Node, so Dang
accepts any object and conveys it as its id. A new dagql Argument.Directive
builder attaches the directive. Together these let a module bind its own
methods as the LLM's tools via base.withTools(currentNode, ...),
unblocking doug2.

Verified for the in-process Dang runtime, where the receiver crosses by
reference. The containerized runtime rides the same fnCall channel but,
along with the interface-typed return, needs a from-source engine to
confirm. SDKs and docs are regenerated.

Signed-off-by: Alex Suraci <[email protected]>
Replace the "glob **/SKILL.md via dang_eval" convention with two read-only
builtins that give the model progressive disclosure of task-specific skills:

- list_skills returns each skill's name and one-line description, parsed from
  its SKILL.md frontmatter.
- read_skill returns a skill's SKILL.md, or a reference file it routes to
  (read_skill(name, file)).

The model cannot read a Dang-teaching skill through a Dang eval it does not yet
know how to write, so discovery and reading must live outside dang_eval.

Skills come from ordered sources behind a skillSource interface. The only source
today is engine-embedded: the dang-language skill in dang's .agents/skills
embed, reached by bumping the dang/v2 pin. An allowlist keeps the compiler-
contributor skills (builtin-dsl, dang-internals, editor-syntaxes, testing) out
of the model's view. Workspace-shipped SKILL.md files will plug in as a second
source.

The dang prompt now points at list_skills/read_skill and nudges reading the
dang-language skill before writing non-trivial scripts.

Signed-off-by: Alex Suraci <[email protected]>
Two token-accounting fixes. Add LLM.contextTokens, the estimated tokens
currently occupying the context window -- the last provider-reported usage
plus an estimate of any messages appended since -- as distinct from the
cumulative LLM.tokenUsage. And stop double-counting cached prompt tokens:
OpenAI and Codex report prompt_tokens inclusive of cached reads, so
subtract the cached portion from InputTokens, record the cache-read metric
they were dropping, and include cache tokens in TotalTokens across the
providers.

Signed-off-by: Alex Suraci <[email protected]>
Drop the per-turn workspace diff/host-sync apparatus: the shell
snapshotted the whole workspace before and after every turn to render a
"Changes" sidebar and power ctrl+s/ctrl+u host syncing, forcing a full
re-sync of the tree on every turn. Local edit round-tripping now goes
through the engine-side overlay instead: ctrl+s exports the accumulated
changeset with a diff preview.

In its place: a live status line computed from token metrics (current
context occupancy vs cumulative spend, aggregated by last value per
series), per-step context growth under --debug, and removal of the
redundant sidebar and shell var syncing along with the passthrough shell
span.

Signed-off-by: Alex Suraci <[email protected]>
LLM message logs followed the old TUI practice checks used to: each
message span set reveal=true and `dagger shell` opened a passthrough
`shell` span it manually zoomed into. Checks have since moved to an
attribute-driven, reveal-independent surfacing model, so mirror it for
the conversation.

DB.SurfacedConversation walks message spans (LLMRole set) into a tree
the same way SurfacedChecks walks CheckName: it honors Boundary and
Encapsulate containment, nests a sub-agent's turns under the tool call
that spawned them, orders by start time, and skips the internal system
prompt. A CONVERSATION section renders it at the top of the final
report, and promoteConversationLocked (the analog of promoteChecksLocked)
surfaces it live by marking the root passthrough, replacing the shell's
manual zoom (SetPrimary is dropped). reveal stays on the message spans
as the live promotion signal, exactly as checks keep it.

Signed-off-by: Alex Suraci <[email protected]>
vito added 13 commits July 17, 2026 18:47
Reconcile generated clients after rebasing onto the reworked
llm-foundation branch: pick up the conversation API rework (hasPending,
transcript, portableID, step/loop maxSteps and maxTokens arguments) and
the tokenUsage field docs in the documented GraphQL schema and the SDK
clients, alongside the workspace-era API this branch adds.

Signed-off-by: Alex Suraci <[email protected]>
Signed-off-by: Alex Suraci <[email protected]>
The replay decoder now parses recordings in the v1 messages-export
shape (lowerCamel keys: callId, toolName, tokenUsage), but the
hello-world golden and the workspace-rebind inline recording still used
the old snake_case spelling. Tool-call blocks decoded with empty names,
so the recorded swap/write calls never dispatched and both tests read a
workspace that was never mutated.

Signed-off-by: Alex Suraci <[email protected]>
Replace stored goldens and hand-written recording JSON with canned
conversations: each test constructs its exact message history through
the LLM API (withPrompt/withResponse/withToolResult), exports it with
the same messages selection a real recording uses, and replays the
result via a replay/ model. The recording is derived from the engine
under test on every run, so its shape cannot drift from the replay
decoder — the failure mode where stale snake_case recordings silently
decoded to empty tool names. This also drops the -update flow and its
live-provider requirement: the goldens and daggerForwardSecrets go away
and the suites need no API keys.

Signed-off-by: Alex Suraci <[email protected]>
Skills previously came from two fixed sources: the engine-embedded dang
skills and SKILL.md files discovered in the bound workspace.
LLM.withSkills(directory) adds a third: explicitly installed skill
directories, using the same **/SKILL.md discovery convention. Sources
are consulted in engine, installed, workspace order, so installed
skills win name collisions with ambient workspace skills but cannot
shadow the engine's built-ins.

The model's skill index is now also introspectable as LLM.skills (an
LLMSkill name/description list served verbatim from list_skills),
giving tests and dagger shell a direct view of what the model sees.
Installed directories are re-emitted by withResetWorkspace and attached
as dependency results so they survive session persistence and cache
lifetimes. Integration tests cover discovery across all three sources,
precedence, the reset/portableID round trip, and the live
list_skills/read_skill tool path via a canned replay conversation.

Signed-off-by: Alex Suraci <[email protected]>
these break codegen, and will all be rewritten anyway

Signed-off-by: Alex Suraci <[email protected]>
Signed-off-by: Alex Suraci <[email protected]>
The go-programmer rewrite to Dang deleted the toy-workspace Go fixture
(go.mod, main.go, dagger.gen.go), but a later codegen regen resurrected
toy-workspace.gen.go on its own. Without its companion files it falls into
the root Go module and references undefined symbols, failing typecheck in
golang:lint-all and ci:bootstrap. Nothing references the fixture anymore.

Signed-off-by: Alex Suraci <[email protected]>
Fix the remaining golang:lint-all findings introduced on this branch:
gofmt/goimports ordering in core/llm_skills.go and spacing in the
core/schema/llm.go doc strings, two nolint:dupl directives in
core/schema/directory.go that no longer suppress anything, and a gocritic
appendAssign in internal/cmd/dagger/llm.go rewritten with slices.Concat to
match the established pattern in core/changeset.go.

Signed-off-by: Alex Suraci <[email protected]>
Binding the LLM to a Workspace stamped currentWorkspace results with a
per-client session-resource handle whose requirement propagated through
every execution dependency, like secrets. That made all workspace-derived
results private to the creating session, so content-addressed module
function results re-executed across sessions instead of hitting cache,
breaking TestContextualWorkspaceCaching. Introduce value-scoped handles
whose requirement follows value embedding (the workspace result itself and
results attaching it via AttachDependencyResults, e.g. an LLM bound to it)
rather than derivation, and persist the embedded set with the cache. The
dead-client gating for LLM resume is preserved via the embedding edges.

Signed-off-by: Alex Suraci <[email protected]>
The object-tools rewrite removed the ListMethods/SelectMethods/CallMethod
surface but dagger mcp was never migrated, so a served module exposed no
module methods at all: a bare LLM binds no tool objects. MCP now binds
each served workspace module's main object through the canonical server
(entrypoint constructors are not in the sugared schema), skipping
constructors with required non-Workspace args, when nothing else is
bound. Rewrite the MCP tests to the object-tools surface; the privileged
variants are renamed since --env-privileged no longer has a core-API tool
surface post-Env and now only gates module-less serving.

Signed-off-by: Alex Suraci <[email protected]>
The live self-updating DurationView rendered raw wall-clock duration,
bypassing renderDuration's self-time and waiting-suffix logic, so blocked
spans showed a ticking total instead of "0.0s ⋯ waiting on <span>",
breaking TestRenderLiveWaitingSuffix. Extract the logic into
renderSpanDuration and use it from DurationView.Render.

Signed-off-by: Alex Suraci <[email protected]>
@vito
vito force-pushed the llm-workspace-llm-binding branch from e59375a to ef0103e Compare July 17, 2026 23:21
vito and others added 5 commits July 17, 2026 19:22
Two skills to ease future work on the pretty TUI. tui-surfacing documents
how the frontend promotes deep spans to the top level: the
reveal-independent SurfacedX computation, live promotion via root
passthrough, the report-vs-live render split, the marker attributes, and
a recipe for adding a new surfaced section. It was reconstructed while
adding the LLM conversation surfacing, which otherwise takes several
explore passes to piece together.

tui-qa gains a general "reading the screen reliably" section: un-wrap
capture-pane output with -J before parsing, include scrollback with -S,
grep for crash markers a final-screen glance misses, and exit through the
app's own quit path so its teardown and final render actually run.

Signed-off-by: Alex Suraci <[email protected]>
Synthesize the hard-won knowledge about how the LLM's Workspace flows
through the engine: the two-workspace (bound vs frozen) model, how a
module/generator/tool resolves its workspace, the seed-vs-propagate
mechanism across the module boundary (the Env machinery re-derived), the
lazy-changeset gotcha, the A/B debugging methodology, and the from-source
dev-engine QA loop.

Signed-off-by: Alex Suraci <[email protected]>
Signed-off-by: Alex Suraci <[email protected]>
Documents the diagnosis and agreed design for the workspace overlay read-root
full-sync fix: why the full read root had to go entirely (Directory.withChanges
cannot be lazy), the caller audit that bounded the blast radius to resolveRootfs
and readConfigBytes, decided trade-offs (no Root for host overlays, uniform
merge formula, requested-only base includes), and validation steps.

Also records the pre-existing TestWorkspaceSDKReadersUseStagedOverlay hang — a
dagql cache self-deadlock in attachResult when ObjectResultArray items are
created via NewObjectResultForCurrentCall, so attaching an item looks up the
parent call's own in-flight result and waits on its own attachDepsWaitCh. This
was previously misdiagnosed as a connection-leak timeout; the doc captures the
goroutine evidence, a dump recipe for nested dev engines, and fix directions.

Signed-off-by: Alex Suraci <[email protected]>
Signed-off-by: Alex Suraci <[email protected]>
@vito
vito force-pushed the llm-workspace-dev-tooling branch from 4c4c366 to 1604c41 Compare July 17, 2026 23:22
@vito
vito force-pushed the llm-workspace-llm-binding branch 8 times, most recently from ce96ed1 to 8f3856a Compare July 21, 2026 23:29
@vito

vito commented Jul 22, 2026

Copy link
Copy Markdown
Contributor Author

folded into #13635

@vito vito closed this Jul 22, 2026
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