Skip to content

P0: agent edit-loop trust & teaching (CRLF fix, pre-flight discoverability, prescriptive errors)#38

Closed
lukaisailovic wants to merge 5 commits into
mainfrom
feat/agent-edit-loop-p0
Closed

P0: agent edit-loop trust & teaching (CRLF fix, pre-flight discoverability, prescriptive errors)#38
lukaisailovic wants to merge 5 commits into
mainfrom
feat/agent-edit-loop-p0

Conversation

@lukaisailovic

Copy link
Copy Markdown
Owner

P0 — Trust & teaching

The MCP edit loop is the product and the agent is its user. Pass-1 research found most "missing features" already exist — the real cost is discoverability and trust: every place an agent guesses wrong burns a guess→fail→retry cycle. This is the P0 slice of PLAN.md: cheap, hits every session, restores the "actions are safe" promise.

Three independent workstreams, one package each:

fix(compiler) — CRLF append corruption

appendLines joined and separated rows with LF regardless of the file's existing line-ending dialect, so appending to a CRLF file (via an action or a connector — both route here) mixed in LF and corrupted it. Now it detects the dialect from existing content and uses it for the separator, the join, and the trailing newline. Regression test covers CRLF preservation and LF-stays-LF over the public resolveWriter path.

feat(mcp-server) — pre-flight discoverability (shift knowledge left)

  • listIslands now lists each island's optional field NAMES alongside required — so capabilities like drilldown/target are visible before the agent acts. Names only, not full schemas (avoids the prior keystone-bloat incident).
  • getOverview returns hints pointing at the under-discovered affordances: runSql({dataset}) read-back, patchManifest's section deep-merge (don't resend the whole manifest), and runAction/runSync.
  • getIslandSchema notes carry copyable examples for the chronically-guessed shapes (drilldown, gauge.goal goals, content.editor file/dir).

feat(schema) — prescriptive structural errors

The validator's diagnosis is good (names page/index/type/field) but its prescription dropped to generic Zod text for nested structures. Now a copyable correct-shape example is appended to the four chronically-guessed structures — drilldown, gauge.goal goals, content.editor, and the select page filter — on both the generic Zod path and the semantic checks. Failure-path only; no schema, type, or validation-outcome change (a valid manifest stays valid, an invalid one keeps the same {page,index,type,field}). The in-loop example JSON matches the getIslandSchema notes byte-for-byte.

Verification

pnpm build && pnpm typecheck && pnpm test && pnpm lint — all green. pnpm validate:templates — all 4 templates valid (confirms the validator change is failure-path only). Per-package: schema 171, compiler 154, mcp 148+3 new, runtime 389.

Out of scope (deliberately)

P1+ from the plan: runActions({atomic}), delete/update action modes, previewDataset alias, richer templates/examples page, connector copy, telemetry. This PR is P0 only.

appendLines joined and separated rows with LF regardless of the target
file's existing dialect, so appending to a CRLF file (via an action or a
connector) mixed in LF and corrupted it. Detect the dialect from the
existing content and use it for the separator, the join, and the trailing
newline. Adds a CRLF/LF regression test over the public resolveWriter path.
…es pre-flight

Shift discoverability left so agents stop guessing:
- listIslands lists each island's optional field NAMES (not full schemas —
  names only, no keystone bloat), alongside required.
- getOverview returns hints pointing at runSql({dataset}) read-back,
  patchManifest's section deep-merge, and runAction/runSync.
- getIslandSchema notes carry copyable examples for the chronically-guessed
  shapes (drilldown, gauge.goal goals, content.editor file/dir).
… errors

When an agent guesses a nested shape wrong, the validator dropped to generic
Zod text that names the rule, not the correct shape. Append a copyable
correct-shape example to the four chronically-guessed structures — drilldown,
gauge.goal goals, content.editor, and the select page filter — on both the
generic Zod path and the semantic checks. Failure-path only; no schema, type,
or validation-outcome change.
…tion

runActions([{ action, rows }, ...], { atomic }) runs several action inserts as
one unit. atomic (default true) validates every call's rows first and writes
nothing if any is invalid; a mid-batch write failure rolls back the writes
already applied in reverse order — restoring a snapshot, or removing a
newly-created file. Returns per-call { action, inserted, checkpoint_id } plus
checkpoint_ids.

BREAKING CHANGE: the singular runAction(name, rows) is removed — call
runActions([{ action: name, rows }]) for a single insert. The form.entry schema
description is updated to match.
…templates

Replace every runAction reference with runActions in the MCP/data docs, the
agent skill (and its synced template copies), and the example/template READMEs.
Add two golden-path recipes to start.md and the skill: an atomic parent+children
multi-write, and deriving a metric with a SQL transform.
@lukaisailovic lukaisailovic deleted the feat/agent-edit-loop-p0 branch June 26, 2026 16:18
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