Skip to content

Epic: surpass Claude Code on agentic coding (subagents, modes, checkpoints, background) #196

Description

@Delqhi

Goal: be better than Claude Code on agentic coding

This epic tracks the four architectural gaps where Claude Code is currently
ahead of SIN-Code on agent loops, tools, and autonomy — each scoped so it can be
closed without breaking Mandate M2 (one static binary, CGO_ENABLED=0,
SQLite via modernc.org/sqlite, no new runtime dependency).

Where SIN-Code is already AHEAD (do not rebuild)

  • Verification gate + independent stop-gate (internal/agentloop,
    internal/stopgate): completion authority is decoupled from the worker. Claude
    Code has no equivalent — it trusts its own "done".
  • Closed learning loop (internal/lessons): persistent, cross-session
    failure memory injected before the first turn. Claude Code does not learn
    across sessions.
  • Swarm mode (swarm_cmd.go): N profiles race, first verified result wins.
  • Orchestrator (internal/orchestrator): critic / adversary / confidence
    calibration (Brier score).

The strategy below is deliberately to layer Claude Code's strengths on top of
these
, so each new capability also inherits our verification + learning — which
is what makes the result better, not just equal.

Gaps to close

Suggested sequencing

  1. Subagents: isolated-context delegation (sin_subagent) #192 subagents first — it is the foundation Background tasks (sin_background / sin bg list|logs|cancel) #195 builds on and the single
    biggest competitive step.
  2. Session-wide permission modes (plan / acceptEdits / bypass) #193 permission modes — small, additive, immediately improves autonomous-run UX.
  3. Workspace checkpointing + rewind (sin checkpoint / sin rewind) #194 checkpoint/rewind — safety net that makes bypass/acceptEdits modes safe to use.
  4. Background tasks (sin_background / sin bg list|logs|cancel) #195 background tasks — composes Subagents: isolated-context delegation (sin_subagent) #192 onto goroutines.

Non-negotiable constraints (apply to all four)

  • M2: no new third-party runtime dependency; single static binary; CGO_ENABLED=0.
  • Additive only: default behavior (no flag / empty config) must be byte-for-byte
    identical to today so existing tests and runs are unaffected.
  • Every new surface gets unit tests and keeps go build ./... green.

Activity

  1. added
    enhancementNew feature or request
    epicUmbrella tracker
    loop-systemAgent loop core: budget, gates, delegation
    on Jun 16, 2026
  2. Delqhi commented on Jun 16, 2026

    @Delqhi
    CollaboratorAuthor

    Implementation Roadmap (v0.1 draft — open for feedback)

    Each issue below maps to a single PR with a clear scope, mandate-compliance check, and acceptance criteria. The four sub-issues build on each other: #192 is the foundation, the rest compose it.


    PR 1: #192 Subagents (foundation, 1-2 weeks)

    Scope: spawn isolated child context, return summary, propagate stop-gate + lessons.

    // internal/subagent/spawn.go
    type SpawnOpts struct {
        Prompt    string
        Profile   string  // agent profile name
        MaxTurns  int     // child-side budget (defense in depth)
        VerifyCmd string  // child runs verify-gate on its result
    }
    
    type SpawnResult struct {
        Summary  string
        Verdict  string  // verified | unverified | failed
        Tokens   int
        CostUSD  float64
    }
    
    func Spawn(ctx context.Context, opts SpawnOpts) (SpawnResult, error)

    Key constraints:

    • Each subagent gets a fresh agentloop.Loop (no shared state with parent)
    • The parent's verification gate is RE-RUN on the child's summary (defense in depth)
    • Lessons are READ-ONLY for the child (no writes — they're the parent's domain)
    • The child's transcript is saved but never sent back to the parent (only the summary)
    • Spawning is bounded: max 4 concurrent subagents per parent turn

    Acceptance:

    • sin subagent 'review the auth module' returns a 200-word summary + a verdict
    • The summary passes the parent's verify-gate (so the parent can trust it)
    • Lessons are filtered: the child sees parent's pre-existing lessons but its own attempts don't pollute them
    • Test coverage ≥ 80%; race-clean

    PR 2: #193 Permission modes (additive, 2-3 days)

    Scope: three session-wide modes layered on the existing per-tool rule engine.

    Mode Behavior
    plan (default) Read-only tools allowed; mutating tools require explicit approval
    acceptEdits Edit/Write allowed; Bash requires approval; deny list still hard-blocks
    bypass All allow-list tools allowed; deny list still hard-blocks

    Key constraints:

    • Layered: bypass mode does NOT override the deny list (M4 mandate preserved)
    • The mode is set per session, not per turn (no flip-flopping)
    • The mode is logged in the session transcript for audit

    Acceptance:

    • sin-code chat --mode=plan shows mutating tools as 'ask' in the rule engine
    • sin-code chat --mode=acceptEdits allows Edit/Write without per-tool approval
    • sin-code chat --mode=bypass still blocks 'Bash:rm -rf' via the deny list
    • All three modes pass existing tests (additive only)

    PR 3: #194 Checkpoints (safety net, 3-5 days)

    Scope: auto-snapshot before mutating tools; sin checkpoint / sin rewind.

    Storage: content-addressed via modernc.org/sqlite. Each checkpoint = a Merkle root of the workspace files. The Checkpoint table is keyed by session-id + turn-id.

    type Checkpoint struct {
        ID        string  // session-id:turn-id
        Merkle    [32]byte
        CreatedAt time.Time
        Files     int  // count
        Size      int  // total bytes
    }

    Key constraints:

    • Snapshot ONLY on mutating tools (Edit, Write, Bash with non-readonly verbs)
    • Snapshot is incremental (only changed files; baseline = last checkpoint)
    • Rewind is per-turn (not per-session) — no global undo
    • Rewind is logged; the operator must explicitly confirm

    Acceptance:

    • After 3 Edit operations, sin checkpoint list shows 3 entries
    • sin rewind <id> restores the workspace to that snapshot
    • sin rewind on a non-mutating turn is a no-op
    • Rewinding doesn't delete the lesson log (the agent can learn from the rewind)

    PR 4: #195 Background tasks (compose, 3-5 days)

    Scope: sin_background CLI + sin bg list|logs|cancel. Each background task is a subagent.Spawn on a goroutine.

    type BackgroundTask struct {
        ID        string
        Prompt    string
        StartedAt time.Time
        Status    string  // running | verified | failed | cancelled
        Result    *SpawnResult
    }
    
    func Background(ctx context.Context, opts SpawnOpts) (string, error)  // returns task id
    func List(filter TaskFilter) []BackgroundTask
    func Logs(id string, lines int) string
    func Cancel(id string) error

    Key constraints:

    • Each background task is a fresh agentloop.Loop (no shared state with parent)
    • The parent turn can return immediately after Spawn; the task runs concurrently
    • The result is stored in SQLite; the parent reads it on demand via sin bg logs
    • The on_complete hook fires the parent's lesson-recorder automatically (closed learning loop)

    Acceptance:

    • sin_background 'refactor auth module' returns a task id immediately
    • sin bg list shows the task as 'running' then 'verified' when done
    • sin bg logs <id> shows the child's transcript (truncated to last 100 lines by default)
    • sin bg cancel <id> kills the goroutine cleanly (defer-based cleanup)
    • The parent's session does not block on the background task

    Sequencing rationale

    1. Subagents: isolated-context delegation (sin_subagent) #192 first — every other feature builds on it. Without isolated contexts, the other three are unsafe to use.
    2. Session-wide permission modes (plan / acceptEdits / bypass) #193 second — small, immediately useful, no architectural risk. Unlocks the demo: sin-code chat --mode=acceptEdits is a much better UX than today's per-tool approval.
    3. Workspace checkpointing + rewind (sin checkpoint / sin rewind) #194 third — provides the safety net that makes --mode=bypass actually safe. Without it, bypass is just 'turn off safety'.
    4. Background tasks (sin_background / sin bg list|logs|cancel) #195 last — composes Subagents: isolated-context delegation (sin_subagent) #192 onto goroutines; the moment we have a working subagent.Spawn, background tasks are a 50-line wrapper.

    Total estimate

    What this epic does NOT do


    This is a draft. Open for review before PR 1 starts.

  3. Delqhi commented on Jun 16, 2026

    @Delqhi
    CollaboratorAuthor

    All four Gaps closed (sequencing as suggested in body):

    Sub-issues are all closed. The non-negotiable constraints held:

    Closing this epic. The roadmap item 'surpass Claude Code on
    agentic coding' is satisfied for this cycle.

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

    enhancementNew feature or requestepicUmbrella trackerloop-systemAgent loop core: budget, gates, delegation

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions