ccrystal-dev-hygiene
Standardized session conclusion and debrief protocol for Context Crystal developers and AI agents. Ensures causal state persistence, clean worktree/branch hygiene across multi-forge remotes, in-flight lease defense, and zero workspace debris before session close.
- License 许可
- MIT
- 最近更新
- 2026-10-22
- Stars
- ★ 0
- Forks
- 0
01 前言 Front Matter
- name
- ccrystal-dev-hygiene
- metadata
- { "version": "1.0", "schemaVersion": "1.0.0" }
- description
- Standardized session conclusion and debrief protocol for Context Crystal developers and AI agents. Ensures causal state persistence, clean worktree/branch hygiene across multi-forge remotes, in-flight lease defense, and zero workspace debris before session close.
03 SKILL.md 正文
Context Crystal Developer & Session Hygiene Skill
This skill codifies the complete Session Conclusion, Debrief & Hygiene Protocol for human developers and AI entities working on the Context Crystal codebase.
While onboarding workflows focus on session inception, this skill standardizes the equally vital ceremony of session closure—guaranteeing that every session leaves the repository, remote forges, causal crystals, and transient workspace resources in a clean, predictable, and zero-debris state.
Activate this skill whenever a collaborator indicates: "let's wrap up for today", "let's close the session", "clean up before we leave", or before tearing down an active environment.
The Six Pillars of Session Conclosure
flowchart TD
A["1. Causal State & In-Flight Audit"] --> B["2. Operational Learning & Memory"]
B --> C["3. Roadmap & Milestone Alignment"]
C --> D["4. Worktree & Clone Hygiene"]
D --> E["5. Local & Remote Multi-Forge Git"]
E --> F["6. Push Gate & Ephemeral Teardown"]
Pillar 1: Causal State & In-Flight Audit
Never close a session with unresolved or ambiguous crystal state:
- Run Cave Triage:
Execute
ccrystal triageor call MCPcrystal_triageto evaluate active crystals across the cave. - Cold Storage for Concluded Crystals:
Move all concluded, completed, or superseded crystals to cold storage (
ccrystal archive <id>or MCPcrystal_archive) to prevent active cave bloat while preserving full DAG history and artifact lineage. - Clean Archival & In-Flight Dependency Audit:
Before archiving a crystal, explicitly audit whether the session spawned external asynchronous commitments (e.g. upstream PRs awaiting review, third-party directory listings awaiting crawl, verification tokens) or unregistered workspace resources (temporary worktrees or clones):
- Commitments In-Flight: Do NOT archive prematurely. Keep the crystal in
in_progressstatus. - Track Tasks: Ensure open tracking tasks (
task-N) exist for all pending external events. - Defend Leases: Register or maintain transient resource leases (
git_worktree,mock_service) to defend in-progress clones against premature deletion. - Record Checkpoint: Append a checkpoint node (
node-N) logging the latest status check.
- Commitments In-Flight: Do NOT archive prematurely. Keep the crystal in
Pillar 2: Operational Learning & Memory Codification
Durable insights and architectural lessons must not remain trapped in conversational transcripts:
- Operational Learning Gate: Reflect on any friction, surprises, or new patterns discovered during the session (e.g. linker flags, API peculiarities, forge behavior).
- Persistent Cognitive Memory (Vendor-Agnostic / If Configured): If the collaborator or agent harness has a long-term memory or cognitive persistence mechanism configured (e.g. Engram, persistent memory scratchpad, or custom agent memory), save major architectural decisions, trade-offs, and learnings to ensure recall across future sessions.
- Repository Invariants: If a learning is universal, reproducible, and relevant to the codebase, codify it directly into AGENTS.md or relevant skill documents. Repo-internal meta-rules belong in internal docs; user-facing changes belong in public release notes.
Pillar 3: Roadmap & Milestone Alignment
Ensure the next session can resume instantly without amnesia or priority ambiguity:
- Review Next Steps: Inspect conductor/next-steps.md and conductor/tracks.md.
- Reflect on Architectural Ordering: Evaluate whether recent discoveries impact future tracks (e.g. scheduling Cold Storage Purge before Cross-Crystal Connections to avoid rework).
- Update Next Track Registration: Explicitly name and detail the immediate next track so that the next session can branch into a worktree and start with zero setup friction.
Pillar 4: Worktree & Clone Lifecycle Hygiene
Prevent orphaned git worktrees and auxiliary clones from consuming disk space and creating confusion:
- Audit Active Worktrees:
Run
git worktree listfrom the primary repository. Ensure only persistent trees (main,gh-pages) remain. - Audit Auxiliary Worktree Directory:
Inspect
../ccrystal-worktrees/:- If an upstream PR has been merged or closed, safely remove the clone directory (
rm -rf ../ccrystal-worktrees/<name>). - If a clone is tied to an active lease, preserve it and confirm its path matches the lease.
- If an upstream PR has been merged or closed, safely remove the clone directory (
- Never Remove Prematurely:
Never prune a track worktree until its PR is merged on the remote forge and local
mainis fast-forwarded.
Pillar 5: Local & Remote Multi-Forge Git Hygiene
Context Crystal synchronizes across two upstream forges: GitHub (github) and Codeberg (origin). Both enforce protected main branches and require linear, PR-reviewed history:
-
Working Tree Verification: Verify
git statusacross all workspaces (context-crystal,context-crystal-gh-pages). Ensure all changes are committed and cryptographically signed (user.signingkey). -
Clean Local Merged Branches: Safely delete local branches that have merged into
main:git branch --merged main | grep -v -E "^\*|main|gh-pages" | xargs -r git branch -d -
Prune Stale Remote Pointers: Run
git fetch --prune github && git fetch --prune originso local tracking pointers drop branches already merged and deleted on the remotes. -
Clean Merged Remote Branches on Codeberg & GitHub: Safely remove merged feature branches from remotes using tolerant per-branch deletion:
for b in branch1 branch2; do git push origin --delete "$b" 2>/dev/null || true done -
Final Remote Audit: Verify
git branch -ashows onlymainandgh-pagesacross local and remote heads.
Pillar 6: Operator Push Gate & Ephemeral File Teardown
To honor our Dual-Credential Strategy & Push Gate (Cryptographic Role Separation):
- Push Helper Pattern:
When multiple pushes across remotes or worktrees are pending, generate a clean, executable script (
/tmp/push_pending.sh) withset -euo pipefail. - Strict Operator Confirmation:
Entities must never execute
git pushautonomously. Instruct the operator to run the script using their locked transport key (SSH remote authentication). - Ephemeral File Teardown:
Immediately after the push succeeds, remove all temporary scripts (
rm -f /tmp/push_*.sh). Do not leave scratch scripts in/tmpor the workspace.
Quick-Reference Checklist
Before concluding any session, check off each item:
- [ ]
ccrystal triageexecuted; concluded crystals archived to cold storage. - [ ] In-flight external dependencies audited; active crystals defend transient leases.
- [ ] Durable learnings recorded to long-term memory (if configured) and codified into docs if universal.
- [ ] Roadmap (conductor/next-steps.md) updated with next track priorities.
- [ ] Merged clones/worktrees in
../ccrystal-worktrees/pruned. - [ ] Local merged branches deleted with
git branch -d. - [ ] Remote branches pruned (
fetch --prune) and dead branches deleted. - [ ] All workspaces committed with signed commits (
user.signingkey). - [ ] Operator executed push helper with locked transport key.
- [ ] Ephemeral helper scripts in
/tmpdestroyed. - [ ] Both
githubandoriginremotes verified up to date and clean.
04 同仓库更多 Skills
sample_runner
暂无简介
media
暂无简介
multi-channel-release
Standardized playbook and operational invariants for end-to-end multi-channel releases of Context Crystal across GitHub Releases, Maven Central (Sonatype Central Portal), Homebrew, and Coursier.
context-crystal
Universal agent skill for Context Crystal. Automates context lifecycle management, state transitions, session persistence, context cleavage, and prompt hydration with zero learning curve for users.
media
暂无简介
multi-channel-release
暂无简介