Skip to content

feat(context): two-tier agent context, deterministic drift inspection, and migration skill - #40

Merged
nilbot merged 15 commits into
masterfrom
feat/two-tier-context-cli-and-migration-skill
Aug 31, 2026
Merged

feat(context): two-tier agent context, deterministic drift inspection, and migration skill#40
nilbot merged 15 commits into
masterfrom
feat/two-tier-context-cli-and-migration-skill

Conversation

@nilbot

@nilbot nilbot commented Aug 31, 2026

Copy link
Copy Markdown
Owner

Summary

This PR implements the Two-Tier Agent Context architecture and Model A hybrid migration workflow as specified in docs/design/2026-08-29-two-tier-context-and-llm-migration-architecture.md and docs/plans/2026-08-31-two-tier-context-and-llm-migration-plan.md.

Highlights

  1. Asset Embedding & Full Scaffolding (internal/scaffold):

    • Embeds canonical starter assets via Go standard embed.FS (assets.go).
    • scaffold.Create non-destructively scaffolds Tier 1 router (AGENTS.md / CLAUDE.md), Tier 2 domain context (.agents/AGENTS.md), starter skills, and the 4-store docs/{design,plans,journal,qna}/ hierarchy.
    • scaffold.RefreshInfrastructuralSkills safely synchronizes 100% agents-owned machine skills without touching custom user skills.
  2. Deterministic Drift Inspection (internal/drift & agents drift):

    • Pure deterministic dynamic-programming LCS diffing against canonical templates.
    • SHA256 canonical and legacy digest catalog with thread-safe memoization.
    • Adds agents drift [--json] [--repo <path>] [--all] for single-repo and fleet inspection (exitcode.OK for clean, exitcode.Advisory for drift).
  3. Granular agents doctor Diagnostics (internal/doctor):

    • Replaces generic scaffold checks with 5 granular diagnostics:
      • scaffold:router: Clean current vs. clean legacy vs. drifted vs. missing.
      • scaffold:symlink: Relative symlink integrity (CLAUDE.md -> AGENTS.md).
      • scaffold:domain: .agents/AGENTS.md presence.
      • scaffold:skill-recording: .agents/skills/recording-what-you-learn/.
      • scaffold:skill-migrating: .agents/skills/migrating-fleet-context/.
  4. Refined agents update Wiring & Skill Refresh (cmd_fleet.go):

    • Rewires machine hooks and refreshes migrating-fleet-context across registered repositories.
    • Emits non-mutating advisory notices when context drift is detected.
  5. Authoritative migrating-fleet-context Skill (.agents/skills/):

    • Comprehensive 5-phase LLM-in-the-loop migration protocol (Preflight -> Branch Isolation -> Semantic Un-nesting -> Docs Realignment -> Automated Gate).
  6. Documentation Invariants:

    • Synchronized README.md, agents/README.md, and built-in help text matching live command dispatch tables.

Verification

  • go test -count=1 ./... in agents/: 100% PASS across all 15 packages.
  • ./bootstrap check: 8 ok, 0 warn, 0 fail.
  • All 7 tasks verified via two-stage subagent reviews (spec review + code review) and final whole-branch review.

nilbot added 15 commits August 31, 2026 22:38
…kill

* commit '68fdbd0':
  feat(cli): add agents drift subcommand with json and fleet inspection
@nilbot
nilbot merged commit 8269574 into master Aug 31, 2026
11 checks passed
@nilbot
nilbot deleted the feat/two-tier-context-cli-and-migration-skill branch August 31, 2026 23:10
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.

1 participant