From 333d9a66c6e8a15c6cf9aa403a3c438a3edcbc2f Mon Sep 17 00:00:00 2001 From: Miguel Martinez Trivino Date: Mon, 5 Oct 2026 12:17:52 +0200 Subject: [PATCH 1/4] docs(specs): add spec 003 for spec capture during the session Refs #3515 Assisted-by: Claude Code Signed-off-by: Miguel Martinez Trivino Chainloop-Trace-Sessions: 4737da59-9559-43a7-b1b0-ede018375481 --- docs/specs/003-spec-capture-during-session.md | 120 ++++++++++++++++++ 1 file changed, 120 insertions(+) create mode 100644 docs/specs/003-spec-capture-during-session.md diff --git a/docs/specs/003-spec-capture-during-session.md b/docs/specs/003-spec-capture-during-session.md new file mode 100644 index 000000000..7458c856a --- /dev/null +++ b/docs/specs/003-spec-capture-during-session.md @@ -0,0 +1,120 @@ +--- +owner: migmartri +ticket: https://github.com/chainloop-dev/chainloop/issues/3515 +prd: +--- + +# Spec 003: Spec capture during the session + +## Summary +This spec changes the spec capture of [Spec 002](002-session-spec-capture.md). It does not replace it. Today the agent captures the spec only at session start. It also captures the user prompt, which the transcript already holds. With this change, the agent does not capture the user's request prompt, because the transcript holds it. A short reminder at each user turn tells the agent to capture a new spec or image from the user. It also tells the agent to capture a changed spec again. The limit on spec files for each session goes from 10 to 25. + +## Problem +- The agent captures the user prompt as a spec of kind `text`. The prompt is the first message of the transcript, so the spec material adds no information. The spec list then shows a duplicate as if it were external context. +- The agent receives the capture instruction only at session start. The push does not record a spec that the session creates or changes later. Example: the agent writes a design note in a local notes folder outside the repository. It edits the note many times, and subagents use it as their plan. The evidence does not hold this note, but it holds the prompt and the screenshots. +- A resumed session gets no instruction when the spec folder already holds a file. +- The limit of 10 files keeps the oldest files. In a long session, a spec added late is the first one that the push drops. + +## Goals and Non-Goals +- Goal: the spec materials of a session do not hold the user's request prompt. +- Goal: the evidence holds each spec or image that the user gives after the start. It holds each changed spec with its content at push time. +- Goal: the reminder is short and narrow, so that it does not overload the session. +- Goal: the agent still decides what a spec is, as Spec 002 decided (D-001 of Spec 002). +- Non-goal: a list of known spec locations, or rules in the CLI that decide if a file is a spec. +- Non-goal: a new attestation when only the specs changed. A push records new specs only with a new AI-assisted commit, as today. +- Non-goal: a spec for a push after the session ends. Spec 002 accepted this loss, and this spec keeps it. +- Non-goal: changes to the materials, the redaction, or the storage that Spec 002 defines. + +## Requirements + +### R-001: No request prompt +The capture instruction MUST tell the agent not to capture the user's request prompt. A spec that the user pastes, for example ticket text or a design document, is still a spec. The agent MUST still use kind `text` for a plan that the session approved. +- Done when: a session that starts from a one-line prompt and no other source pushes no spec material. + +### R-002: Reminder at each user turn +The system MUST give the agent a short capture reminder at each user prompt, in each agent that has a channel for it. The reminder MUST include the absolute path of the session folder. +- Done when: a resumed session receives the reminder at its next user prompt, also when the folder already holds files. + +### R-003: Three cases only +The reminder MUST tell the agent to capture in these cases only: +- The user pastes or gives a new spec. +- The user pastes or gives an image. +- A spec changes, also when the session itself edits it. + +For a changed spec, the agent MUST overwrite its spec file with the current content. A local document has its local path as the source address. +- Done when: a session writes a design note outside the working tree and works from it. The push records that note as a `document` spec with its final content. + +### R-004: Higher file limit +The push MUST record at most 25 spec files for each session. When there are more, it MUST keep the oldest files and record a warning, as Spec 002 does today. + +## Constraints +- The repository is public. The instruction and the reminder text are visible to all users. +- The reminder goes into the agent context at each turn. It must stay short, so that it costs few tokens and does not distract the agent from the task. +- Each agent has its own hook channels. An agent without a channel for the prompt-submit event gets only the session-start instruction. + +## Proposal +The user does nothing new. + +At session start, the trace hook gives the full capture instruction, as in Spec 002. The instruction no longer lists "a written prompt" as a source. It tells the agent that the transcript already holds the conversation, so a prompt is not a spec. Kind `text` stays for a plan that the user approved in the session and for spec text that came from outside the conversation. + +At each user prompt, the trace hook adds a short reminder to the agent context. The reminder names the session folder and covers three cases. When the user pastes or gives a new spec, copy it. When the user pastes or gives an image, copy it. When a spec changes, copy it again. The reminder says nothing else. A spec that the session writes, for example a design note in a local notes folder, is a spec that changes. Its local path is the source address. The push records the content on disk at push time, so the final version of a plan replaces its drafts. + +The reminder replaces the old rule that gave the session-start instruction only while the folder was empty. A resumed session gets the reminder at its first user prompt, so it does not need the full instruction again. + +The push keeps the rules of Spec 002, with a limit of 25 files instead of 10. A push with no new AI-assisted commits still sends no attestation. The next AI-assisted commit records a spec that the agent added after the last push. The session-end hook still deletes the folder. + +Each agent receives the reminder through its own channel: + +| Agent | Channel at each user prompt | +|-------|-----------------------------| +| Claude Code | The additional context of the prompt-submit hook response. | +| Cursor | None today. The agent gets the session-start instruction only (D-008). | +| OpenCode | The Chainloop plugin adds a context-only message, as it does at session start. | + +```mermaid +sequenceDiagram + actor User + participant Agent as Coding agent + participant Hook as Trace hook or plugin + participant Folder as Session folder + participant CLI as Trace push + + User->>Agent: Start session with a task + Agent->>Hook: Session start event + Hook-->>Agent: Full capture instruction (no prompt capture) + Agent->>Folder: Write ticket, documents, images + loop Each user turn + User->>Agent: Prompt + Agent->>Hook: Prompt submit event + Hook-->>Agent: Short reminder with folder path + Note over User,Agent: New spec or image, or a spec changes + Agent->>Folder: Copy it, or overwrite its file + end + User->>CLI: git push + CLI->>Folder: Read up to 25 spec files + CLI->>CLI: Redact, upload, reference (as in Spec 002) +``` + +## Decision Record + +| ID | Decision | Choice | Why (and what we rejected) | Source | +|----|----------|--------|----------------------------|--------| +| D-001 | Capture of a user prompt | Do not capture the user's request prompt. Capture a spec that the user pastes | The transcript is already part of the session evidence, so the spec material is a duplicate. Rejected: keep it and label it "prompt" in the user interface (more data and UI work for no new information). | drafting | +| D-002 | How the system finds specs after session start | A short reminder at each user prompt, with three cases: a new spec, a new image, a changed spec. The agent decides what a spec is | Simple, and it keeps D-001 of Spec 002. It covers resumed sessions. Three narrow cases keep the reminder short, so it does not overload the session. Rejected: a general rule to capture anything that looks like a spec (too much capture). Rejected: a list of known spec locations that a hook watches (a new configuration, and it misses specs at other paths). Rejected: the hook copies matching files itself (the CLI decides what a spec is, and captures noise). Rejected: a check at push time against the transcript (needs transcript analysis for each agent). Rejected: a reminder after each Markdown write (misses a spec that the agent only reads, and more hook logic). | drafting | +| D-003 | A spec added after the last push, with no new AI-assisted commit | Record it with the next AI-assisted commit, as today | An attestation with no new commit is a duplicate of the session. Rejected: push a new attestation when the set of spec digests changed. | drafting | +| D-004 | A push after the session ends | No change: the session-end hook deletes the folder, and that push holds no spec | Accepted in Spec 002. Rejected: keep the folder until the next push, with an age limit (state to track and clean for a rare case). | drafting | +| D-005 | Spec file limit | Raise from 10 to 25 and keep the oldest files | The reminder makes more spec files likely in a long session. The oldest files are the sources the session started from. Rejected: keep the newest files (the start ticket can drop). | drafting | +| D-006 | Relation to Spec 002 | This spec changes Spec 002 and does not supersede it | Most of the capture design does not change. | drafting | +| D-007 | Control of overcapture from the reminder | Measure the number of spec files for each session after release. Make the reminder narrower if the number grows | The three cases are already narrow. Data from real sessions shows if more limits are necessary. | drafting | +| D-008 | Cursor | The session-start instruction only, until Cursor documents a channel that adds context at prompt submit | No channel to use today. | drafting | + +## Open Questions +None. + +## Risks + +| Risk | Mitigation | +|------|------------| +| The agent ignores the reminder, as it ignored the instruction to add a file when the task changed. | The reminder comes at each turn, near the work, and not only at session start. The capture rate of Spec 002 (R-010) stays measurable. | +| A spec written and pushed in the same turn is not captured, because the next reminder comes later. | The session-start instruction still says to update the folder when the task changes. The next push with a new commit records it. | +| The reminder adds tokens to each turn. | Keep it to a few lines. The full instruction stays at session start only. | \ No newline at end of file From 549ab56ae4967bc2f27512bcb0ffd14f8c290b1a Mon Sep 17 00:00:00 2001 From: Miguel Martinez Trivino Date: Mon, 5 Oct 2026 12:30:36 +0200 Subject: [PATCH 2/4] docs(specs): keep capturing approved plans in spec 003 Refs #3515 Assisted-by: Claude Code Signed-off-by: Miguel Martinez Trivino --- docs/specs/003-spec-capture-during-session.md | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/docs/specs/003-spec-capture-during-session.md b/docs/specs/003-spec-capture-during-session.md index 7458c856a..1d85d91c3 100644 --- a/docs/specs/003-spec-capture-during-session.md +++ b/docs/specs/003-spec-capture-during-session.md @@ -7,7 +7,7 @@ prd: # Spec 003: Spec capture during the session ## Summary -This spec changes the spec capture of [Spec 002](002-session-spec-capture.md). It does not replace it. Today the agent captures the spec only at session start. It also captures the user prompt, which the transcript already holds. With this change, the agent does not capture the user's request prompt, because the transcript holds it. A short reminder at each user turn tells the agent to capture a new spec or image from the user. It also tells the agent to capture a changed spec again. The limit on spec files for each session goes from 10 to 25. +This spec changes the spec capture of [Spec 002](002-session-spec-capture.md). It does not replace it. Today the agent captures the spec only at session start. It also captures the user prompt, which the transcript already holds. With this change, the agent does not capture the user's request prompt, because the transcript holds it. A short reminder at each user turn tells the agent to capture a new spec or image from the user. It also tells the agent to capture an approved plan, and a changed spec again. The limit on spec files for each session goes from 10 to 25. ## Problem - The agent captures the user prompt as a spec of kind `text`. The prompt is the first message of the transcript, so the spec material adds no information. The spec list then shows a duplicate as if it were external context. @@ -17,7 +17,7 @@ This spec changes the spec capture of [Spec 002](002-session-spec-capture.md). I ## Goals and Non-Goals - Goal: the spec materials of a session do not hold the user's request prompt. -- Goal: the evidence holds each spec or image that the user gives after the start. It holds each changed spec with its content at push time. +- Goal: the evidence holds each spec or image that the user gives after the start, and each plan that the user approves. It holds each changed spec with its content at push time. - Goal: the reminder is short and narrow, so that it does not overload the session. - Goal: the agent still decides what a spec is, as Spec 002 decided (D-001 of Spec 002). - Non-goal: a list of known spec locations, or rules in the CLI that decide if a file is a spec. @@ -28,21 +28,23 @@ This spec changes the spec capture of [Spec 002](002-session-spec-capture.md). I ## Requirements ### R-001: No request prompt -The capture instruction MUST tell the agent not to capture the user's request prompt. A spec that the user pastes, for example ticket text or a design document, is still a spec. The agent MUST still use kind `text` for a plan that the session approved. +The capture instruction MUST tell the agent not to capture the user's request prompt. A spec that the user pastes, for example ticket text or a design document, is still a spec. The agent MUST still capture a plan that the user approves in the session, as kind `text`. - Done when: a session that starts from a one-line prompt and no other source pushes no spec material. ### R-002: Reminder at each user turn The system MUST give the agent a short capture reminder at each user prompt, in each agent that has a channel for it. The reminder MUST include the absolute path of the session folder. - Done when: a resumed session receives the reminder at its next user prompt, also when the folder already holds files. -### R-003: Three cases only +### R-003: Four cases only The reminder MUST tell the agent to capture in these cases only: - The user pastes or gives a new spec. - The user pastes or gives an image. +- The user approves a plan. The agent captures it as kind `text`. - A spec changes, also when the session itself edits it. For a changed spec, the agent MUST overwrite its spec file with the current content. A local document has its local path as the source address. - Done when: a session writes a design note outside the working tree and works from it. The push records that note as a `document` spec with its final content. +- Done when: the user approves a plan in the session. The push records that plan as a `text` spec. ### R-004: Higher file limit The push MUST record at most 25 spec files for each session. When there are more, it MUST keep the oldest files and record a warning, as Spec 002 does today. @@ -57,7 +59,7 @@ The user does nothing new. At session start, the trace hook gives the full capture instruction, as in Spec 002. The instruction no longer lists "a written prompt" as a source. It tells the agent that the transcript already holds the conversation, so a prompt is not a spec. Kind `text` stays for a plan that the user approved in the session and for spec text that came from outside the conversation. -At each user prompt, the trace hook adds a short reminder to the agent context. The reminder names the session folder and covers three cases. When the user pastes or gives a new spec, copy it. When the user pastes or gives an image, copy it. When a spec changes, copy it again. The reminder says nothing else. A spec that the session writes, for example a design note in a local notes folder, is a spec that changes. Its local path is the source address. The push records the content on disk at push time, so the final version of a plan replaces its drafts. +At each user prompt, the trace hook adds a short reminder to the agent context. The reminder names the session folder and covers four cases. When the user pastes or gives a new spec, copy it. When the user pastes or gives an image, copy it. When the user approves a plan, write it as kind `text`. When a spec changes, copy it again. The reminder says nothing else. A spec that the session writes, for example a design note in a local notes folder, is a spec that changes. Its local path is the source address. The push records the content on disk at push time, so the final version of a plan replaces its drafts. The reminder replaces the old rule that gave the session-start instruction only while the folder was empty. A resumed session gets the reminder at its first user prompt, so it does not need the full instruction again. @@ -87,7 +89,7 @@ sequenceDiagram User->>Agent: Prompt Agent->>Hook: Prompt submit event Hook-->>Agent: Short reminder with folder path - Note over User,Agent: New spec or image, or a spec changes + Note over User,Agent: New spec or image, approved plan, or a spec changes Agent->>Folder: Copy it, or overwrite its file end User->>CLI: git push @@ -100,12 +102,12 @@ sequenceDiagram | ID | Decision | Choice | Why (and what we rejected) | Source | |----|----------|--------|----------------------------|--------| | D-001 | Capture of a user prompt | Do not capture the user's request prompt. Capture a spec that the user pastes | The transcript is already part of the session evidence, so the spec material is a duplicate. Rejected: keep it and label it "prompt" in the user interface (more data and UI work for no new information). | drafting | -| D-002 | How the system finds specs after session start | A short reminder at each user prompt, with three cases: a new spec, a new image, a changed spec. The agent decides what a spec is | Simple, and it keeps D-001 of Spec 002. It covers resumed sessions. Three narrow cases keep the reminder short, so it does not overload the session. Rejected: a general rule to capture anything that looks like a spec (too much capture). Rejected: a list of known spec locations that a hook watches (a new configuration, and it misses specs at other paths). Rejected: the hook copies matching files itself (the CLI decides what a spec is, and captures noise). Rejected: a check at push time against the transcript (needs transcript analysis for each agent). Rejected: a reminder after each Markdown write (misses a spec that the agent only reads, and more hook logic). | drafting | +| D-002 | How the system finds specs after session start | A short reminder at each user prompt, with four cases: a new spec, a new image, an approved plan, a changed spec. The agent decides what a spec is | Simple, and it keeps D-001 of Spec 002. It covers resumed sessions. Four narrow cases keep the reminder short, so it does not overload the session. Rejected: a general rule to capture anything that looks like a spec (too much capture). Rejected: a list of known spec locations that a hook watches (a new configuration, and it misses specs at other paths). Rejected: the hook copies matching files itself (the CLI decides what a spec is, and captures noise). Rejected: a check at push time against the transcript (needs transcript analysis for each agent). Rejected: a reminder after each Markdown write (misses a spec that the agent only reads, and more hook logic). | drafting | | D-003 | A spec added after the last push, with no new AI-assisted commit | Record it with the next AI-assisted commit, as today | An attestation with no new commit is a duplicate of the session. Rejected: push a new attestation when the set of spec digests changed. | drafting | | D-004 | A push after the session ends | No change: the session-end hook deletes the folder, and that push holds no spec | Accepted in Spec 002. Rejected: keep the folder until the next push, with an age limit (state to track and clean for a rare case). | drafting | | D-005 | Spec file limit | Raise from 10 to 25 and keep the oldest files | The reminder makes more spec files likely in a long session. The oldest files are the sources the session started from. Rejected: keep the newest files (the start ticket can drop). | drafting | | D-006 | Relation to Spec 002 | This spec changes Spec 002 and does not supersede it | Most of the capture design does not change. | drafting | -| D-007 | Control of overcapture from the reminder | Measure the number of spec files for each session after release. Make the reminder narrower if the number grows | The three cases are already narrow. Data from real sessions shows if more limits are necessary. | drafting | +| D-007 | Control of overcapture from the reminder | Measure the number of spec files for each session after release. Make the reminder narrower if the number grows | The four cases are already narrow. Data from real sessions shows if more limits are necessary. | drafting | | D-008 | Cursor | The session-start instruction only, until Cursor documents a channel that adds context at prompt submit | No channel to use today. | drafting | ## Open Questions From fb7441cd5368f49360e97d38e252f55db95e007f Mon Sep 17 00:00:00 2001 From: Miguel Martinez Trivino Date: Mon, 5 Oct 2026 13:52:26 +0200 Subject: [PATCH 3/4] docs(specs): keep earlier recorded specs and clarify pasted images in spec 003 Signed-off-by: Miguel Martinez Trivino Chainloop-Trace-Sessions: d40e4682-088b-4b8f-869e-c9fc7834c1b4 --- docs/specs/003-spec-capture-during-session.md | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/docs/specs/003-spec-capture-during-session.md b/docs/specs/003-spec-capture-during-session.md index 1d85d91c3..261dcb2c1 100644 --- a/docs/specs/003-spec-capture-during-session.md +++ b/docs/specs/003-spec-capture-during-session.md @@ -38,7 +38,7 @@ The system MUST give the agent a short capture reminder at each user prompt, in ### R-003: Four cases only The reminder MUST tell the agent to capture in these cases only: - The user pastes or gives a new spec. -- The user pastes or gives an image. +- The user gives an image as a file path or a URL. The agent copies the file. For a pasted image, the agent writes a description, as D-010 of Spec 002 says. - The user approves a plan. The agent captures it as kind `text`. - A spec changes, also when the session itself edits it. @@ -47,7 +47,8 @@ For a changed spec, the agent MUST overwrite its spec file with the current cont - Done when: the user approves a plan in the session. The push records that plan as a `text` spec. ### R-004: Higher file limit -The push MUST record at most 25 spec files for each session. When there are more, it MUST keep the oldest files and record a warning, as Spec 002 does today. +The push MUST record at most 25 spec files for each session. When there are more, it MUST record a warning, as Spec 002 does today. The push MUST NOT drop a file that an earlier push of the session recorded, also when the agent overwrote that file later. New files fill the remaining places, oldest first. The order of files on disk changes when the agent overwrites a file, so it MUST NOT decide which files the push keeps. +- Done when: a session goes over 25 files after the agent overwrites its starting ticket. The push still records the starting ticket. ## Constraints - The repository is public. The instruction and the reminder text are visible to all users. @@ -59,11 +60,11 @@ The user does nothing new. At session start, the trace hook gives the full capture instruction, as in Spec 002. The instruction no longer lists "a written prompt" as a source. It tells the agent that the transcript already holds the conversation, so a prompt is not a spec. Kind `text` stays for a plan that the user approved in the session and for spec text that came from outside the conversation. -At each user prompt, the trace hook adds a short reminder to the agent context. The reminder names the session folder and covers four cases. When the user pastes or gives a new spec, copy it. When the user pastes or gives an image, copy it. When the user approves a plan, write it as kind `text`. When a spec changes, copy it again. The reminder says nothing else. A spec that the session writes, for example a design note in a local notes folder, is a spec that changes. Its local path is the source address. The push records the content on disk at push time, so the final version of a plan replaces its drafts. +At each user prompt, the trace hook adds a short reminder to the agent context. The reminder names the session folder and covers four cases. When the user pastes or gives a new spec, copy it. When the user gives an image file or URL, copy it. For a pasted image, write a description. When the user approves a plan, write it as kind `text`. When a spec changes, copy it again. The reminder says nothing else. A spec that the session writes, for example a design note in a local notes folder, is a spec that changes. Its local path is the source address. The push records the content on disk at push time, so the final version of a plan replaces its drafts. The reminder replaces the old rule that gave the session-start instruction only while the folder was empty. A resumed session gets the reminder at its first user prompt, so it does not need the full instruction again. -The push keeps the rules of Spec 002, with a limit of 25 files instead of 10. A push with no new AI-assisted commits still sends no attestation. The next AI-assisted commit records a spec that the agent added after the last push. The session-end hook still deletes the folder. +The push keeps the rules of Spec 002, with a limit of 25 files instead of 10. Over the limit, it never drops a file that an earlier push of the session recorded. A push with no new AI-assisted commits still sends no attestation. The next AI-assisted commit records a spec that the agent added after the last push. The session-end hook still deletes the folder. Each agent receives the reminder through its own channel: @@ -93,7 +94,7 @@ sequenceDiagram Agent->>Folder: Copy it, or overwrite its file end User->>CLI: git push - CLI->>Folder: Read up to 25 spec files + CLI->>Folder: Read up to 25 spec files, earlier recorded files first CLI->>CLI: Redact, upload, reference (as in Spec 002) ``` @@ -105,7 +106,7 @@ sequenceDiagram | D-002 | How the system finds specs after session start | A short reminder at each user prompt, with four cases: a new spec, a new image, an approved plan, a changed spec. The agent decides what a spec is | Simple, and it keeps D-001 of Spec 002. It covers resumed sessions. Four narrow cases keep the reminder short, so it does not overload the session. Rejected: a general rule to capture anything that looks like a spec (too much capture). Rejected: a list of known spec locations that a hook watches (a new configuration, and it misses specs at other paths). Rejected: the hook copies matching files itself (the CLI decides what a spec is, and captures noise). Rejected: a check at push time against the transcript (needs transcript analysis for each agent). Rejected: a reminder after each Markdown write (misses a spec that the agent only reads, and more hook logic). | drafting | | D-003 | A spec added after the last push, with no new AI-assisted commit | Record it with the next AI-assisted commit, as today | An attestation with no new commit is a duplicate of the session. Rejected: push a new attestation when the set of spec digests changed. | drafting | | D-004 | A push after the session ends | No change: the session-end hook deletes the folder, and that push holds no spec | Accepted in Spec 002. Rejected: keep the folder until the next push, with an age limit (state to track and clean for a rare case). | drafting | -| D-005 | Spec file limit | Raise from 10 to 25 and keep the oldest files | The reminder makes more spec files likely in a long session. The oldest files are the sources the session started from. Rejected: keep the newest files (the start ticket can drop). | drafting | +| D-005 | Spec file limit | Raise from 10 to 25. Never drop a file that an earlier push recorded. New files fill the remaining places, oldest first | The reminder makes more spec files likely in a long session. The oldest files are the sources the session started from. An overwrite changes the modification time of a file, so an order by modification time can drop an edited start ticket. Rejected: keep the newest files (the start ticket can drop). Rejected: keep the oldest files by modification time only (an overwritten file moves to the end). | [PR comment](https://github.com/chainloop-dev/chainloop/pull/3516#discussion_r4182950724) | | D-006 | Relation to Spec 002 | This spec changes Spec 002 and does not supersede it | Most of the capture design does not change. | drafting | | D-007 | Control of overcapture from the reminder | Measure the number of spec files for each session after release. Make the reminder narrower if the number grows | The four cases are already narrow. Data from real sessions shows if more limits are necessary. | drafting | | D-008 | Cursor | The session-start instruction only, until Cursor documents a channel that adds context at prompt submit | No channel to use today. | drafting | From 6ff1d1b1776aa4dc639ba9818341e8f18b4ae655 Mon Sep 17 00:00:00 2001 From: Miguel Martinez Trivino Date: Mon, 5 Oct 2026 13:59:50 +0200 Subject: [PATCH 4/4] docs(specs): do not capture pasted images in spec 003, record as known limitation Signed-off-by: Miguel Martinez Trivino --- docs/specs/003-spec-capture-during-session.md | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/docs/specs/003-spec-capture-during-session.md b/docs/specs/003-spec-capture-during-session.md index 261dcb2c1..c13578c0e 100644 --- a/docs/specs/003-spec-capture-during-session.md +++ b/docs/specs/003-spec-capture-during-session.md @@ -38,7 +38,7 @@ The system MUST give the agent a short capture reminder at each user prompt, in ### R-003: Four cases only The reminder MUST tell the agent to capture in these cases only: - The user pastes or gives a new spec. -- The user gives an image as a file path or a URL. The agent copies the file. For a pasted image, the agent writes a description, as D-010 of Spec 002 says. +- The user gives an image as a file path or a URL. The agent copies the file. The agent does not capture a pasted image (D-009). - The user approves a plan. The agent captures it as kind `text`. - A spec changes, also when the session itself edits it. @@ -60,7 +60,7 @@ The user does nothing new. At session start, the trace hook gives the full capture instruction, as in Spec 002. The instruction no longer lists "a written prompt" as a source. It tells the agent that the transcript already holds the conversation, so a prompt is not a spec. Kind `text` stays for a plan that the user approved in the session and for spec text that came from outside the conversation. -At each user prompt, the trace hook adds a short reminder to the agent context. The reminder names the session folder and covers four cases. When the user pastes or gives a new spec, copy it. When the user gives an image file or URL, copy it. For a pasted image, write a description. When the user approves a plan, write it as kind `text`. When a spec changes, copy it again. The reminder says nothing else. A spec that the session writes, for example a design note in a local notes folder, is a spec that changes. Its local path is the source address. The push records the content on disk at push time, so the final version of a plan replaces its drafts. +At each user prompt, the trace hook adds a short reminder to the agent context. The reminder names the session folder and covers four cases. When the user pastes or gives a new spec, copy it. When the user gives an image file or URL, copy it. When the user approves a plan, write it as kind `text`. When a spec changes, copy it again. The reminder says nothing else. A spec that the session writes, for example a design note in a local notes folder, is a spec that changes. Its local path is the source address. The push records the content on disk at push time, so the final version of a plan replaces its drafts. The reminder replaces the old rule that gave the session-start instruction only while the folder was empty. A resumed session gets the reminder at its first user prompt, so it does not need the full instruction again. @@ -110,6 +110,7 @@ sequenceDiagram | D-006 | Relation to Spec 002 | This spec changes Spec 002 and does not supersede it | Most of the capture design does not change. | drafting | | D-007 | Control of overcapture from the reminder | Measure the number of spec files for each session after release. Make the reminder narrower if the number grows | The four cases are already narrow. Data from real sessions shows if more limits are necessary. | drafting | | D-008 | Cursor | The session-start instruction only, until Cursor documents a channel that adds context at prompt submit | No channel to use today. | drafting | +| D-009 | Pasted images | Do not capture a pasted image. Record it as a known limitation | The agent cannot copy the bytes of a pasted image into the folder. A description that the agent writes is not the image, so it adds little value. Rejected: a description of kind `image` (D-010 of Spec 002). This spec changes that decision. | [PR comment](https://github.com/chainloop-dev/chainloop/pull/3516#discussion_r4183303763) | ## Open Questions None. @@ -120,4 +121,5 @@ None. |------|------------| | The agent ignores the reminder, as it ignored the instruction to add a file when the task changed. | The reminder comes at each turn, near the work, and not only at session start. The capture rate of Spec 002 (R-010) stays measurable. | | A spec written and pushed in the same turn is not captured, because the next reminder comes later. | The session-start instruction still says to update the folder when the task changes. The next push with a new commit records it. | -| The reminder adds tokens to each turn. | Keep it to a few lines. The full instruction stays at session start only. | \ No newline at end of file +| The reminder adds tokens to each turn. | Keep it to a few lines. The full instruction stays at session start only. | +| Known limitation: the evidence does not hold a pasted image as a spec (D-009). | The transcript still holds the conversation. A later version can take the image bytes from the transcript at push time. | \ No newline at end of file