Skip to content

Implement tagged-block merge engine for workstream installs #1139

Closed as not planned

Description

@mfrieman

Problem

mfrieman/agentic-ai-collective
(v0.1.0-alpha) uses a tagged-block merge convention to let workstream
compositions add content to existing squad documents without clobbering
user-authored content. Merge files live under compositions/workstreams/<name>/merge/
with a .merge suffix and contain content wrapped in HTML comment tags:

<!-- squad:start:code-review-routing -->
## Code Review routing
...workstream-owned content...
<!-- squad:end:code-review-routing -->

When a workstream is installed, its merge patches are injected into the target
file (e.g., .squad/routing.md) between those tags. When the workstream is
removed, only content between the tags is removed — the rest of the file is
untouched.

The upstream Squad CLI has no merge engine. There is no command to process .merge
files, no concept of tagged blocks, and no mechanism to cleanly remove
workstream-contributed content during uninstall.

Current state

.merge files in compositions/workstreams/<name>/merge/ have no CLI consumer.
Consumers process them by hand. Workstream installs and removals do not exist.

Desired state

A tagged-block merge engine embedded in the Squad CLI, used internally by
squad workstream add and squad workstream remove.

Tag format

<!-- squad:start:{block-id} -->
<content owned by this workstream>
<!-- squad:end:{block-id} -->
  • {block-id} is a string unique within the file (e.g., code-review-routing).
  • Tags use HTML comment syntax so they are invisible in rendered Markdown.
  • Content between tags is fully owned by the workstream. User edits outside the
    tags are always preserved.

Merge operations

Insert (during workstream add):

If the block-id does not exist in the target file:
  Append the tagged block at the end of the file (or at the position
  specified in the .merge file via an `after:` directive).
If the block-id already exists:
  Replace the existing block content with the new version.

Remove (during workstream remove):

If the block content matches the installed version (no user edits):
  Remove the entire tagged block including the comment tags.
If the block content has been modified by the user:
  Warn. Leave the block in place. Do not destroy user edits.
  The user must remove manually or pass --force.

Upgrade (during workstream upgrade):

Replace block content with the new version's content.
Warn if the block was modified by the user since install.

.merge file format

# merge target: .squad/routing.md
# position: after-section: "## Routing"

<!-- squad:start:code-review-routing -->
## Code review routing

Route `review` tasks to the `code-reviewer` agent.
<!-- squad:end:code-review-routing -->

Acceptance criteria

  • squad workstream add processes all .merge files in the workstream and
    injects tagged blocks into target files without overwriting any content
    outside the tag boundaries.
  • Installing the same workstream twice produces identical output (idempotent).
  • squad workstream remove removes tagged blocks for the specified workstream,
    leaving all content outside the blocks unchanged.
  • If a tagged block has been user-modified since install, remove prints a
    warning and skips that block unless --force is passed.
  • squad workstream upgrade replaces the tagged block content with the new
    version's content, with a warning if user edits are detected.
  • The tag format (<!-- squad:start:{id} --> / <!-- squad:end:{id} -->) is
    documented and stable so users know which content is workstream-managed.
  • The merge engine is usable standalone via a lower-level command (e.g.,
    squad merge apply <file> <block-id> <content>) for tooling/scripting use.

References

Notes

  • The HTML comment tag format keeps squad-managed blocks invisible in rendered
    Markdown, which is important for .squad/ files that are rendered by squad and
    read by AI agents.
  • The position: directive in .merge files is optional but important for
    readability — appending to the end of the file is a sensible default, but some
    content (e.g., routing rules) needs to be in a specific section.
  • Consider whether tag IDs should be namespaced by workstream alias
    (e.g., review:code-review-routing) to prevent collisions when multiple
    workstreams are installed.
  • The merge engine is also potentially useful outside workstreams — any tool that
    wants to contribute governed sections to a shared config file (CI, bots) could
    use this same primitive.

Activity

  1. bradygaster commented on Nov 5, 2026

    @bradygaster
    Collaborator

    Closing as not planned for the 2.0 line during board triage (owner decision). The squad:// registry/workstream install work is out of scope for 2.0; reopen if it returns to the roadmap.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    triagedIssue has been triagedwave:3-laterWave 3 — backlog, future

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions