Skip to content

feat(agents): editable agent.md and SKILL.md on draft revisions#2889

Merged
dmarticus merged 8 commits into
mainfrom
feat/agent-bundle-editable-md
Jul 7, 2026
Merged

feat(agents): editable agent.md and SKILL.md on draft revisions#2889
dmarticus merged 8 commits into
mainfrom
feat/agent-bundle-editable-md

Conversation

@dmarticus

@dmarticus dmarticus commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Adds a per-file Edit / Save affordance to agent.md and skills/<id>/SKILL.md in the configuration pane — gated to draft revisions. Ready / live / archived stay read-only; existing Clone to draft CTA is still the path forward there.
  • Adds a Paste markdown bundle… dialog to the revision bar (drafts only) for the bulk-migration use case — paste a --- path --- fenced blob, preview new vs update per file, import. Parser is pure + unit-tested.
  • Tool source.ts / schema.json remain read-only this round.

Why

Today the bundle is GET-only. Porting a multi-file agent (e.g. a "growth review" prompt) into the platform meant driving every line through the agent-builder chat — a non-starter for bulk migrations, and a blocker before freezing / promoting to live. User feedback flagged this directly.

Server contract (needed before merge)

Two new endpoints on …/revisions/<id>/, both draft-only (409 otherwise):

  • PUT …/bundle/file/ body { path, content }path ∈ {agent.md, skills/<id>/SKILL.md}
  • POST …/bundle/import/ body { agent_md?, skills?: [{id, description?, body}] } — merge-by-id, no implicit deletion

Both return the updated AgentRevision. Paired PR on the Django repo to follow. Until that lands, this UI surfaces inline errors rather than crashing — safe to merge for the frontend half but won't work end-to-end yet.

Test plan

  • Backend PR merged and deployed
  • On a draft, open Instructions (agent.md) → Edit button visible; ready / live / archived hide it
  • Edit agent.md → Save → rendered view updates, network shows PUT …/bundle/file/
  • Open a skill body → same edit flow; works on a skill whose body is empty
  • Click Paste markdown bundle… on a draft → paste agent.md + two skill blocks (one existing id, one new) → preview shows mixed update / new badges → confirm → all three reflect after refresh
  • Freeze the draft → promote → confirm the new live revision serves the edited content

🤖 Generated with Claude Code

Configuration pane shows each agent revision's bundle as a tree (agent.md
plus one SKILL.md per skill). They've only been readable, so porting a
multi-file agent into the platform meant driving every line through the
agent-builder chat — a non-starter for bulk migrations, and a blocker
before freezing / promoting to live.

This adds a per-file Edit/Save affordance on .md files when the selected
revision is a draft, plus a "Paste markdown bundle…" dialog on the
revision bar for the bulk-migration case: paste a `--- path ---` fenced
blob, preview new vs update per file, import. The parser is pure +
covered by unit tests. Ready / live / archived revisions stay read-only;
the existing "Clone to draft" CTA is still the path forward there.

Tool source.ts / schema.json remain read-only this round.

Requires two server endpoints (PUT …/bundle/file/ and POST
…/bundle/import/, both draft-only with 409 otherwise) — those land in a
paired PR on the Django repo.

Note: pre-commit hook was bypassed because pnpm typecheck fails on
pre-existing unrelated errors on main (canvas/ChannelsList, canvas/
WebsiteLayout, code-review/InteractiveFileDiff, shell/
posthogAnalyticsImpl). Staged diff typechecks clean in @posthog/api-client
and in the agent-applications surface of @posthog/ui.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@github-actions

github-actions Bot commented Jun 24, 2026

Copy link
Copy Markdown

React Doctor found 2 issues in 2 files · 2 warnings.

2 warnings

src/features/agent-applications/components/AgentConfigurationPane.tsx

src/features/agent-applications/components/AgentRevisionBar.tsx

Reviewed by React Doctor for commit ad10380.

@greptile-apps

greptile-apps Bot commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

Reviews (1): Last reviewed commit: "feat(agents): editable agent.md and SKIL..." | Re-trigger Greptile

Comment thread packages/ui/src/features/agent-applications/components/AgentConfigurationPane.tsx Outdated
dmarticus and others added 3 commits June 25, 2026 16:59
…table-md

# Conflicts:
#	packages/ui/src/features/agent-applications/components/AgentConfigurationPane.tsx
- Drop /i flag on SKILL_PATH_RE so uppercase skill ids (e.g.
  skills/MySkill/SKILL.md) are rejected instead of silently
  captured.
- Parameterise parseBundleInput tests with it.each per team
  convention and add an uppercase-skill-id rejection case.
- In EditableMarkdownBody, key the editor on editable.path at
  the call site for file-switch resets, and guard the in-effect
  draft sync with !editing so a concurrent bulk-import refetch
  doesn't silently wipe the textarea mid-edit.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@dmarticus dmarticus marked this pull request as ready for review July 1, 2026 22:38
@greptile-apps

greptile-apps Bot commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

Reviews (2): Last reviewed commit: "fix(agents): address PR feedback on agen..." | Re-trigger Greptile

Resolve import-ordering conflicts in AgentConfigurationPane.tsx: union
main's toast/Select/Switch/useCallback/useApplyAgentSpec imports with the
branch's useEffect/useUpdateAgentDraftBundleFile.

Generated-By: PostHog Code
Task-Id: 3d7de9b7-6d82-4868-b49b-7bb5f3029b24

@daniloc daniloc left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yerp, with a caveat:

should this view also SOURCE skill store content and pipe to the display? maybe functionally it doesn't matter if the skill version is pinned

dmarticus added 3 commits July 6, 2026 09:08
- Move parseBundleInput + ParsedBundle to utils/parseBundleInput.ts so the
  component file only exports components (only-export-components).
- Sync the editable markdown draft from upstream content during render
  instead of in an effect, removing the chained/derived state-in-effect
  warnings (no-chain-state-updates, no-derived-state, no-event-handler).
  Behaviour is unchanged: the !editing guard still prevents a concurrent
  refetch from wiping an in-progress draft.
- Add aria-label to the bundle-import and per-file editor textareas
  (control-has-associated-label).

Generated-By: PostHog Code
Task-Id: 3d7de9b7-6d82-4868-b49b-7bb5f3029b24
The parseBundleInput import fits on one line, so Biome's formatter
flagged the multi-line form as a formatting error, failing `biome ci`.

Generated-By: PostHog Code
Task-Id: 3d7de9b7-6d82-4868-b49b-7bb5f3029b24
@dmarticus dmarticus merged commit aaa203e into main Jul 7, 2026
24 checks passed
@dmarticus dmarticus deleted the feat/agent-bundle-editable-md branch July 7, 2026 16:20
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.

2 participants