Skip to content

instructions: managed prepend/append block for targets without @import support #436

Closed

Description

@runkids

Problem

Split from #239 (§4). A shared base AGENTS.md can be connected to targets today, but only in two shapes: whole-file replacement (merge / symlink / copy) or an @path import block at the top of the target file. Only 7 targets read @ imports (claude, codebuddy, commandcode, iflow, omp, qoder, qwen). Cursor, Copilot, Kiro, Codex and the other instruction-file targets therefore cannot have "hub base + project-specific sections" in one file.

Evidence (v0.25.0, aeaea40e)

  • internal/sync/extras_file.go — import mode maintains a <!-- skillshare:instructions:begin/end --> block containing @path lines
  • internal/config/targets.yaml — 47 targets declare an instructions file; 7 declare import support
  • internal/memory/guidance.go — already implements a hash-tagged managed block (configured / outdated / modified / malformed states) but with fixed content

Proposal

Add two single-file extra modes, prepend and append, that write the extra's content (not a reference) into the target file inside a named, sha256-tagged managed block, generalising the state machine in internal/memory/guidance.go:

  • missing → insert at top / bottom
  • outdated → replace in place
  • hand-edited or malformed → refuse and report, like memory guidance does today
  • several extras may target the same file as long as every one uses a managed mode (same rule as import)

This gives non-import targets the same composition that import targets have, and lets several prompt fragments compose into one physical file.

Not in scope

  • merge-sections (heading-level merge). Semantics are unclear (duplicate headings, levels, user-edited sections) and there is no existing code to build on; a managed block covers the same use case.

Size: M.

Metadata

Metadata

Assignees

No one assigned

    Labels

    feature

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions