Skip to content

feat: prime SSOT tasks 8-12 — init upgrade, recipe cleanup, symlink safety, staleness detection (#2139)#2600

Merged
steveyegge merged 10 commits intosteveyegge:mainfrom
maphew:feat/prime-ssot-2139
Mar 16, 2026
Merged

feat: prime SSOT tasks 8-12 — init upgrade, recipe cleanup, symlink safety, staleness detection (#2139)#2600
steveyegge merged 10 commits intosteveyegge:mainfrom
maphew:feat/prime-ssot-2139

Conversation

@maphew
Copy link
Collaborator

@maphew maphew commented Mar 14, 2026

Summary

Completes the remaining tasks (8-12) for the prime SSOT feature (#2139). Tasks 1-7 were already merged to main.

Task 8: bd init upgrade for legacy beads sections

bd init now upgrades legacy beads sections to versioned format (profile+hash markers) instead of silently skipping. New files from EmbeddedDefault() also get versioned markers via upgradeBeadsSection().

Task 9: Recipe template cleanup

Replaced stale bd sync references with bd dolt push in recipes template. Added bd prime SSOT messaging.

Task 10: Symlink safety & profile precedence

installAgents resolves symlinks via utils.ResolveForWrite before reading. Profile precedence: full preserved over minimal when both target same file. checkAgents now reports current/stale/missing with errBeadsSectionStale.

Task 11: Test coverage

9 new tests covering existingBeadsProfile, staleness detection, profile preservation, symlink safety, and legacy-to-new migration.

Task 12: Documentation

Updated docs/SETUP.md with prime SSOT section, profiles table, and profile precedence. Updated docs/CLI_REFERENCE.md with --check behavior and Gemini description.

Closes #2139

maphew and others added 9 commits March 14, 2026 10:10
Add new section to DOLT-BACKEND.md covering:
- Embedded vs central server comparison table
- Why 'brew services start dolt' silently ignores config
- Step-by-step custom LaunchAgent setup with plist
- Environment variables to point beads at central server
- Service management (stop/restart/logs)

Also fix default port from 3306 to 3307 in the server
configuration table to match DefaultSQLPort in code.

Closes steveyegge#2323

Amp-Thread-ID: https://ampcode.com/threads/T-019ced53-6c5c-71de-8092-b834c879a68a
Co-authored-by: Amp <amp@ampcode.com>
…efix-aware parser (steveyegge#2139)

Implement the foundational pieces for making bd prime the single source
of truth for agent instructions:

Task 1 - Shared render API (internal/templates/agents/render.go):
  - Profile type with Full and Minimal constants
  - RenderSection(profile) generates sections with marker metadata
  - ParseMarker() extracts profile/hash from begin markers
  - CurrentHash(profile) for staleness detection
  - 8-char SHA-256 hash for deterministic freshness

Task 2 - Template splitting:
  - New beads-section-minimal.md for hook-enabled agents (Claude, Gemini)
  - Minimal profile: pointer to bd prime + quick reference + landing protocol
  - Existing beads-section.md preserved as full profile body

Task 3 - Parser refactor (cmd/bd/setup/agents.go):
  - Prefix-based marker matching via containsBeadsMarker/findBeginMarker
  - Legacy markers (no metadata) detected and upgradable
  - New markers: <!-- BEGIN BEADS INTEGRATION profile:full hash:a1b2c3d4 -->
  - agentsIntegration gains profile field (defaults to full)
  - updateBeadsSectionWithProfile for profile-aware updates
  - createNewAgentsFileWithProfile for new file creation

Backward compatible: EmbeddedBeadsSection/EmbeddedDefault still work.
Legacy markers are auto-upgraded on next bd setup run.

Amp-Thread-ID: https://ampcode.com/threads/T-019ced5e-0acd-7158-93ad-0695c6d02580
Co-authored-by: Amp <amp@ampcode.com>
…#2139, task 4)

Set profile: agents.ProfileFull explicitly on codex, factory, mux
(all three layers), and opencode integrations. This makes the profile
intent clear and prepares for adding minimal-profile integrations.

Amp-Thread-ID: https://ampcode.com/threads/T-019ced5e-0acd-7158-93ad-0695c6d02580
Co-authored-by: Amp <amp@ampcode.com>
…eyegge#2139, tasks 5-6)

When running 'bd setup claude --project' or 'bd setup gemini --project',
after installing hooks in settings.json, also install a minimal-profile
beads section in AGENTS.md. This provides a quick reference pointer to
'bd prime' for the full workflow, while hooks handle the heavy lifting.

On removal, the beads section is cleaned up from AGENTS.md as well.

The minimal profile contains: quick reference commands, pointer to
bd prime, and the landing-the-plane session close protocol — without
the full issue types, priorities, and sync details that hook-enabled
agents get dynamically from bd prime.

Amp-Thread-ID: https://ampcode.com/threads/T-019ced5e-0acd-7158-93ad-0695c6d02580
Co-authored-by: Amp <amp@ampcode.com>
, task 7)

Update init_agent.go to use agents.RenderSection(ProfileFull) instead
of agents.EmbeddedBeadsSection() when appending beads sections to
existing AGENTS.md files. This ensures new installs get the versioned
marker format with profile and hash metadata.

Amp-Thread-ID: https://ampcode.com/threads/T-019ced5e-0acd-7158-93ad-0695c6d02580
Co-authored-by: Amp <amp@ampcode.com>
…afety, staleness detection (steveyegge#2139)

Task 8: bd init now upgrades legacy beads sections to versioned format
instead of silently skipping them. New files created via EmbeddedDefault()
also get versioned markers.

Task 9: Replace stale bd sync references with bd dolt push in recipes
template. Add bd prime SSOT messaging.

Task 10: installAgents resolves symlinks via ResolveForWrite before
reading content. Profile precedence: if file already has full profile
and minimal is requested, full is preserved to avoid information loss.

Task 11: Added tests for staleness detection, profile extraction,
profile precedence, symlink safety, and legacy-to-new migration.
checkAgents now reports stale/current/missing status.

Task 12: Updated SETUP.md with prime SSOT, profiles, and profile
precedence documentation. Updated CLI_REFERENCE.md with --check
behavior and Gemini integration description.

Amp-Thread-ID: https://ampcode.com/threads/T-019ced7a-0c86-708d-930c-ee35d00eda8d
Co-authored-by: Amp <amp@ampcode.com>
Update agents.md.tmpl to match canonical beads-section.md content:
- 'Version-controlled: Built on Dolt with cell-level merge' →
  'Git-friendly: Dolt-powered version control with native sync'
- JSONL-based sync description → Dolt push/pull sync model
- Legacy markers → versioned markers (profile:full hash:d4f96305)

This ensures EmbeddedDefault() output has a beads section body
identical to beads-section.md, so upgradeBeadsSection() in bd init
is a no-op for freshly created files.

Ref: steveyegge#2139
Amp-Thread-ID: https://ampcode.com/threads/T-019ced8e-4a10-7404-b1f6-83cc78d1996c
Co-authored-by: Amp <amp@ampcode.com>
@maphew maphew requested a review from steveyegge March 14, 2026 18:30
@maphew
Copy link
Collaborator Author

maphew commented Mar 14, 2026

hey steve, apologies for mix-and-match of half committing direct to main and half in this PR. the cats were enthusiastic this morning : -)

steveyegge added a commit that referenced this pull request Mar 15, 2026
…eanup, symlink safety, staleness detection

Closes #2139

PR: #2600
Author: maphew

Co-Authored-By: maphew <maphew@users.noreply.github.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@steveyegge steveyegge merged commit ee4dc91 into steveyegge:main Mar 16, 2026
36 of 40 checks passed
@maphew maphew deleted the feat/prime-ssot-2139 branch March 16, 2026 03:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bd prime should be SSOT for agent instructions — init/setup/prime overlap wastes ~300 tokens/session

2 participants