Skill Tracer
Skills › Compound Engineering › ce-proof › workflows.md

workflows.md

124 lines · skills/ce-proof/references/workflows.md at 3449230

Open on GitHub
1# Proof workflows
2
3Required read before running one of these end to end: reviewing a shared doc, creating and sharing a new one, or pulling a doc down to a local file. Endpoint and operation detail lives in `api.md`.
4

Proof workflows

Required read before running one of these end to end: reviewing a shared doc, creating and sharing a new one, or pulling a doc down to a local file. Endpoint and operation detail lives in api.md.

Raw lines 1 to 4
5## Workflow: Review a Shared Document
6
7When given a Proof URL like `https://www.proofeditor.ai/d/abc123?token=xxx`:
8
91. Extract the slug and token
102. Bind presence with the CE identity defaults
113. Read via `v3/document`
124. Edit with `v3/edit` (narrow content ops; review ops for comments/suggestions)
14```bash
15TOKEN="xxx"
16SLUG="abc123"
17AGENT="ai:compound-engineering"
19curl -sS -X POST "https://www.proofeditor.ai/api/agent/$SLUG/presence" \
20 -H "Content-Type: application/json" \
21 -H "Authorization: Bearer $TOKEN" \
22 -H "X-Agent-Id: $AGENT" \
23 -d '{"name":"Compound Engineering","status":"reading","summary":"Reviewing doc"}'
25DOC=$(curl -sS "https://www.proofeditor.ai/api/agent/$SLUG/v3/document" \
26 -H "Authorization: Bearer $TOKEN" \
27 -H "X-Agent-Id: $AGENT")
28REVISION=$(printf '%s' "$DOC" | jq -r '.revision // empty')
30# Comment on visible text
31curl -sS -X POST "https://www.proofeditor.ai/api/agent/$SLUG/v3/edit" \
32 -H "Content-Type: application/json" \
33 -H "Authorization: Bearer $TOKEN" \
34 -H "X-Agent-Id: $AGENT" \
35 -H "Idempotency-Key: $(uuidgen)" \
36 -d "$(jq -n --argjson rev "${REVISION:-null}" '{
37 by:"ai:compound-engineering",
38 baseRevision: (if $rev == null then null else $rev end),
39 operations:[{op:"comment",on:"text to comment on",body:"Your comment here"}]
40 } | if .baseRevision == null then del(.baseRevision) else . end')"
42# Narrow content edit
43curl -sS -X POST "https://www.proofeditor.ai/api/agent/$SLUG/v3/edit" \
44 -H "Content-Type: application/json" \
45 -H "Authorization: Bearer $TOKEN" \
46 -H "X-Agent-Id: $AGENT" \
47 -H "Idempotency-Key: $(uuidgen)" \
48 -d '{"by":"ai:compound-engineering","operations":[{"op":"replace","find":"old","with":"new"}]}'
50# Tracked suggestion
51curl -sS -X POST "https://www.proofeditor.ai/api/agent/$SLUG/v3/edit" \
52 -H "Content-Type: application/json" \
53 -H "Authorization: Bearer $TOKEN" \
54 -H "X-Agent-Id: $AGENT" \
55 -H "Idempotency-Key: $(uuidgen)" \
56 -d '{"by":"ai:compound-engineering","operations":[{"op":"suggest","kind":"replace","find":"old","with":"new"}]}'
57```

Workflow: Review a Shared Document

When given a Proof URL like https://www.proofeditor.ai/d/abc123?token=xxx:

  1. Extract the slug and token
  2. Bind presence with the CE identity defaults
  3. Read via v3/document
  4. Edit with v3/edit (narrow content ops; review ops for comments/suggestions)
TOKEN="xxx"
SLUG="abc123"
AGENT="ai:compound-engineering"

curl -sS -X POST "https://www.proofeditor.ai/api/agent/$SLUG/presence" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $TOKEN" \
  -H "X-Agent-Id: $AGENT" \
  -d '{"name":"Compound Engineering","status":"reading","summary":"Reviewing doc"}'

DOC=$(curl -sS "https://www.proofeditor.ai/api/agent/$SLUG/v3/document" \
  -H "Authorization: Bearer $TOKEN" \
  -H "X-Agent-Id: $AGENT")
REVISION=$(printf '%s' "$DOC" | jq -r '.revision // empty')

# Comment on visible text
curl -sS -X POST "https://www.proofeditor.ai/api/agent/$SLUG/v3/edit" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $TOKEN" \
  -H "X-Agent-Id: $AGENT" \
  -H "Idempotency-Key: $(uuidgen)" \
  -d "$(jq -n --argjson rev "${REVISION:-null}" '{
    by:"ai:compound-engineering",
    baseRevision: (if $rev == null then null else $rev end),
    operations:[{op:"comment",on:"text to comment on",body:"Your comment here"}]
  } | if .baseRevision == null then del(.baseRevision) else . end')"

# Narrow content edit
curl -sS -X POST "https://www.proofeditor.ai/api/agent/$SLUG/v3/edit" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $TOKEN" \
  -H "X-Agent-Id: $AGENT" \
  -H "Idempotency-Key: $(uuidgen)" \
  -d '{"by":"ai:compound-engineering","operations":[{"op":"replace","find":"old","with":"new"}]}'

# Tracked suggestion
curl -sS -X POST "https://www.proofeditor.ai/api/agent/$SLUG/v3/edit" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $TOKEN" \
  -H "X-Agent-Id: $AGENT" \
  -H "Idempotency-Key: $(uuidgen)" \
  -d '{"by":"ai:compound-engineering","operations":[{"op":"suggest","kind":"replace","find":"old","with":"new"}]}'
Raw lines 5 to 58
59## Workflow: Create and Share a New Document
61**Publishing a local file (the primary case):** read the file and JSON-encode its full contents into the `markdown` field with `jq --rawfile` so newlines, quotes, and backticks are escaped correctly. Never hand-write the body or leave an inline placeholder — that publishes a placeholder doc instead of the source artifact.
63```bash
64SRC="path/to/plan.md"
65TITLE="Plan: Foo"
67RESPONSE=$(jq -n --arg title "$TITLE" --rawfile md "$SRC" '{title:$title, markdown:$md}' \
68 | curl -sS -X POST https://www.proofeditor.ai/share/markdown \
69 -H "Content-Type: application/json" -d @-)
71URL=$(echo "$RESPONSE" | jq -r '.tokenUrl')
72SLUG=$(echo "$RESPONSE" | jq -r '.slug')
73TOKEN=$(echo "$RESPONSE" | jq -r '.accessToken')
74OWNER_SECRET=$(echo "$RESPONSE" | jq -r '.ownerSecret') # required for owner delete while unclaimed
76# Keep OWNER_SECRET in session memory only — never write it into the repo tree.
78curl -sS -X POST "https://www.proofeditor.ai/api/agent/$SLUG/presence" \
79 -H "Content-Type: application/json" \
80 -H "Authorization: Bearer $TOKEN" \
81 -H "X-Agent-Id: ai:compound-engineering" \
82 -d '{"name":"Compound Engineering","status":"reading","summary":"Uploaded doc"}'
84echo "$URL"
85```
87After publish handoffs from planning workflows, surface the URL and return control — do not delete the doc automatically.
89When the user later asks to clean up an unclaimed doc you created:
91```bash
92curl -sS -X DELETE "https://www.proofeditor.ai/api/documents/$SLUG" \
93 -H "Authorization: Bearer $OWNER_SECRET"
94```

Workflow: Create and Share a New Document

Publishing a local file (the primary case): read the file and JSON-encode its full contents into the markdown field with jq --rawfile so newlines, quotes, and backticks are escaped correctly. Never hand-write the body or leave an inline placeholder — that publishes a placeholder doc instead of the source artifact.

SRC="path/to/plan.md"
TITLE="Plan: Foo"

RESPONSE=$(jq -n --arg title "$TITLE" --rawfile md "$SRC" '{title:$title, markdown:$md}' \
  | curl -sS -X POST https://www.proofeditor.ai/share/markdown \
    -H "Content-Type: application/json" -d @-)

URL=$(echo "$RESPONSE" | jq -r '.tokenUrl')
SLUG=$(echo "$RESPONSE" | jq -r '.slug')
TOKEN=$(echo "$RESPONSE" | jq -r '.accessToken')
OWNER_SECRET=$(echo "$RESPONSE" | jq -r '.ownerSecret')   # required for owner delete while unclaimed

# Keep OWNER_SECRET in session memory only — never write it into the repo tree.

curl -sS -X POST "https://www.proofeditor.ai/api/agent/$SLUG/presence" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $TOKEN" \
  -H "X-Agent-Id: ai:compound-engineering" \
  -d '{"name":"Compound Engineering","status":"reading","summary":"Uploaded doc"}'

echo "$URL"

After publish handoffs from planning workflows, surface the URL and return control — do not delete the doc automatically.

When the user later asks to clean up an unclaimed doc you created:

curl -sS -X DELETE "https://www.proofeditor.ai/api/documents/$SLUG" \
  -H "Authorization: Bearer $OWNER_SECRET"
Raw lines 59 to 95
96## Workflow: Pull a Proof Doc to Local
98Sync the current Proof doc state to a local markdown file. Used for:
100- Ad-hoc snapshots of a Proof doc to disk
101- Pulling a shared Proof doc that the user (or others) edited back down to a local working copy
102- Refreshing a local working copy against the live Proof version
104Canonical read for this workflow: `GET /api/agent/$SLUG/v3/document`.
106```bash
107SLUG=<slug>
108TOKEN=<accessToken>
109LOCAL=<absolute-path>
111STATE_TMP=$(mktemp "${TMPDIR:-/tmp}/ce-proof-state.XXXXXX")
112curl -sS "https://www.proofeditor.ai/api/agent/$SLUG/v3/document" \
113 -H "Authorization: Bearer $TOKEN" \
114 -H "X-Agent-Id: ai:compound-engineering" > "$STATE_TMP"
115REVISION=$(jq -r '.revision // empty' "$STATE_TMP")
117TMP="${LOCAL}.proof-sync.$$"
118jq -jr '.markdown' "$STATE_TMP" > "$TMP" && mv "$TMP" "$LOCAL"
119rm "$STATE_TMP"
120```
122`jq -jr` streams markdown bytes without going through a shell variable, so trailing newlines survive. `mv` within the same filesystem is atomic.
124**Confirm before writing when the pull isn't directly asked for.** If a workflow ends up pulling as a side-effect of a different action, surface the impending write with a short confirm like "Sync Proof doc to `<localPath>`?" A silent overwrite is surprising.

Workflow: Pull a Proof Doc to Local

Sync the current Proof doc state to a local markdown file. Used for:

  • Ad-hoc snapshots of a Proof doc to disk
  • Pulling a shared Proof doc that the user (or others) edited back down to a local working copy
  • Refreshing a local working copy against the live Proof version

Canonical read for this workflow: GET /api/agent/$SLUG/v3/document.

SLUG=<slug>
TOKEN=<accessToken>
LOCAL=<absolute-path>

STATE_TMP=$(mktemp "${TMPDIR:-/tmp}/ce-proof-state.XXXXXX")
curl -sS "https://www.proofeditor.ai/api/agent/$SLUG/v3/document" \
  -H "Authorization: Bearer $TOKEN" \
  -H "X-Agent-Id: ai:compound-engineering" > "$STATE_TMP"
REVISION=$(jq -r '.revision // empty' "$STATE_TMP")

TMP="${LOCAL}.proof-sync.$$"
jq -jr '.markdown' "$STATE_TMP" > "$TMP" && mv "$TMP" "$LOCAL"
rm "$STATE_TMP"

jq -jr streams markdown bytes without going through a shell variable, so trailing newlines survive. mv within the same filesystem is atomic.

Confirm before writing when the pull isn't directly asked for. If a workflow ends up pulling as a side-effect of a different action, surface the impending write with a short confirm like "Sync Proof doc to <localPath>?" A silent overwrite is surprising.

Raw lines 96 to 124