Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -389,9 +389,9 @@ the object machinery through a one-way dependency. Their difference is the
imports the launching checkout's clean HEAD at that conversation path.
Add a source and revision to select another repository or commit; Git URLs
require a full commit hash. Ctrl+O browses code entries; the agent
organizes them through ordinary file operations. `/import` adds local or
remote repository commits. `/pr <gitlink> <base-branch> [remote-URL]` previews
one PR, and `/checkout <gitlink> [directory]` exports code for local editing;
organizes them through ordinary file operations. `/import` adds local
repository commits; ask the agent to import remote code, publish a branch,
or create a PR/stack. `/checkout <gitlink> [directory]` exports code for local editing;
- `talk` / `chat` — agent conversations over the current protocol
(`design/chat.md`);
`caos talk "<prompt>"` is the everyday form. A conversation NAMES the two
Expand Down
35 changes: 17 additions & 18 deletions SPEC.md
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,7 @@ with no `@param` tags takes no parameters: the source tree IS its input.
- Tools are discovered fresh from the CURRENT source tree on every LLM round and
resolved again at INVOCATION time, so an agent that edits a tool sees the
change on its next call, within the same turn
- `bash`, `grep`, `read`, `ls`, `write`, `edit`, and `import_source` are reserved. A
- `bash`, `grep`, `read`, `ls`, `write`, `edit`, `import_source`, `publish_source`, and `github` are reserved. A
`caos-tools/bash/` is ignored, not registered — the model's primitives,
including the repair path for a broken tool edit, stay stable whatever the
tree carries
Expand Down Expand Up @@ -616,24 +616,23 @@ revision (and made the history tools' hashes readable the same way).
resolution turn (a leftover marker does not compile) — not by a marker
re-scan, which cannot tell a real marker from a bad resolution.
- The one place to refuse or loudly warn on a non-empty `.caos/conflicts` or a
remaining marker is PUBLISH (the tui's PR or branch flow) — the moment work
remaining marker is PUBLISH (the server push endpoint) — the moment work
actually leaves the conversation.

## Publication

The [conversation publication flow](design/chat.md) publishes one named gitlink
with `/pr <gitlink> <base-remote-branch> [remote-URL]`. Its full path is the PR
branch name. The base is explicit; an omitted URL comes from unambiguous import
provenance. Directory ordering guides review, not publication. Publish earlier
PRs first, then name their remote branches as later PR bases.

The client previews the exact source commit and destination before confirmation.
If the source does not contain the fetched base tip, it offers to import that
base and send the agent a merge/rebase and test request. This action publishes
nothing; run `/pr` again after integration. Successful pushes and PR operations
are recorded as CAOS transcript entries. No snapshot has a special working or
sealed state.

Per-mutation commits remain in the published source tree history. Only the
previewed PR tip is checked for unresolved conflicts and reserved state;
intermediate commits may contain conflict markers or fail to build.
The agent's publish_source(source_tree, repository, branch) records the exact
source commit and expected remote head before invoking caos push-git.
POST /git/push validates that code commit and pushes it directly from the
server's bare repository using an explicit lease and fast-forward check.
Publication does not edit the source or squash its history.

github(repository, args, stdin?) runs the general std/github worker.
Every tool call gets a fresh invocation identity. A Git compare-and-swap claim
prevents a retried worker from repeating a possibly completed command.
An unfinished claim is uncertain; inspect GitHub before proceeding.

PR and stack operations compose these tools. Stack boundaries remain gitlinks;
publish bottom to top and link existing PR URLs with gh stack link.
The TUI's /pr and /publish-branch are removed; /import remains for local paths.
See [agent publication](design/agent-publish.md) for mechanics and recovery.
21 changes: 5 additions & 16 deletions design/agent-harness.md
Original file line number Diff line number Diff line change
Expand Up @@ -360,22 +360,11 @@ points is the caller's tree's business, not this client's (`design/chat.md`,
and freezes redraws for native terminal text selection. `/checkout <gitlink>
[directory]` checks out the named code commit as a detached HEAD in a clean
local checkout. `Ctrl+H` opens the keyboard and slash-command reference.
`/pr <gitlink> <base-remote-branch> [remote-URL]` previews one PR; Enter
confirms. The URL is explicit or inferred from matching import provenance.
Publication pushes the exact code commit, using the gitlink path as the branch
name, then opens or reuses its PR through `gh`. The agent tests the code before
this client operation. Source and base must share history. If the latest base is not an ancestor,
Enter instead imports the base and sends an integration request to the agent;
the user runs `/pr` again afterward to review publication. Changed content, remote drift, conflict markers,
unrelated histories, and reserved `.caos` state stop publication. Merely
opening, running, switching, or publishing conversations never mutates the
checkout. `/publish-branch` pushes the same full-history branch without PR
creation, while `/load` imports a `remote/caos/<conversation>` branch or
GitHub PR back into the canonical server-side conversation. Imports preserve
the ID and event spine, allow only first-parent advancement, and reject
divergent ID collisions. Progress remains one completed API round at a time,
and a running turn is not cancellable until the server/runner protocol grows
cancellation.
Publication uses the agent's publish_source and github tools. The
server pushes the selected code commit; the GitHub worker handles PRs and
stacks. See [publication](agent-publish.md) for frozen inputs, leases and
recovery. The TUI's /pr and /publish-branch are removed. Publishing source
commits never mutates the local checkout.

### Superseded protocol detail

Expand Down
74 changes: 12 additions & 62 deletions design/chat.md
Original file line number Diff line number Diff line change
Expand Up @@ -355,65 +355,15 @@ the user's message. The source path is explicit in both commands.
Browser selection does not choose checkout or publication targets, and does not
change the agent's execution context.

## Publishing with `/pr`

The user enters:

```text
/pr feature/01-change main
```

The client:

1. Reads the commit referenced by `feature/01-change`. That path also supplies
the proposed remote branch name.
2. Determines the destination repository from an explicit optional URL or
unambiguous import provenance matching the oldest sibling's commit.
3. Fetches the requested base branch, here `main`, and checks the source commit.
4. Shows the source path and hash, repository, branch, and base for review.
5. On Enter, rechecks the selected snapshot and remote state, pushes the exact
source commit with its history, and opens or updates the PR using the client's
Git and GitHub credentials. Escape cancels.
6. Records the confirmed push as a `CAOS` message. Successful PR creation or
update adds another message with the PR URL, branch, and base.

The full syntax is `/pr <conversation/gitlink> <base-remote-branch> [remote-URL]`.
The base branch is explicit. The optional remote is a repository URL, not a
local remote name such as `origin`. Missing or ambiguous provenance requires
that URL. The preview shows destination metadata, not a full PR diff.

For a stack, publish each boundary in order:

```text
/pr feature/01-change main
/pr feature/02-tests feature/01-change
```

The preceding branch must exist remotely before it can serve as the next base.
Publication does not squash source history or change the conversation's gitlinks.
`/publish-branch <conversation/gitlink> [remote-URL]` provides the same preview
and branch push without a PR or base-branch requirement.

### When the PR base needs integrating

The source and remote base must share Git history. If the source does not contain
the fetched base tip, the preview offers a different action:

1. On Enter, import that exact base commit under `imports/pr-base-<commit>/base`.
2. Send a message asking the agent to merge or rebase it into the named source
and run checks.
3. After integration, the user runs `/pr` again to review the result.

That confirmation imports and sends the message; it publishes nothing. A failed
import sends no message. The handoff preserves the user's draft and stays in the
original conversation.

Before integrating, the agent checks the full proposed PR scope. Merging upstream
retains inherited branch changes; moving only a small requested edit onto a new
base requires deciding which changes to carry over.

Publication rejects changed snapshots, remote drift, unrelated histories,
conflict markers, and any remaining source-tree `.caos` entry. It never cleans
files or rewrites the reviewed commit at push time. Interrupted pushes are
checked against the destination before retrying, and failed PR operations do
not record a successful PR.
## Publishing

The agent uses publish_source(source_tree, repository, branch) to publish an
exact code commit and github(repository, args, stdin?) for PRs and stacks.
Publication receipts remain in the conversation; source gitlinks do not move.
The TUI's /pr and /publish-branch commands are removed.

See [agent publication and stacks](agent-publish.md) for the server endpoint,
leases, invocation records and stack updates. The agent checks the complete
PR scope and tests before publication. Integrating upstream retains inherited
changes; transplanting only a small edit onto a different base is a separate
operation.
Loading
Loading