Skip to content

About

A strict compliance and code-doc alignment auditor for AI-native development to eliminate Context Drift and enforce final consistency.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

6 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 

Repository files navigation

context-anchor ⚓

An opinionated agent skill built for Matt Pocock's skills ecosystem. Designed for AI-native engineering (Vibe Coding) to eliminate Context Drift and enforce final consistency across your project's knowledge base.

License: MIT Powered by Skills

🧠 The Problem It Solves

AI coding agents (like Claude Code, Cursor, Cline, or Roo Code) can refactor and churn out code at lightning speed. However, they leave local documentation, architecture logs, and project memories behind.

When your .claude/ or .cursor/ reference markdown files become stale, the very next AI session reads out-of-date context and generates broken, regression-prone code. Your documentation and your runtime code fall out of sync.

context-anchor solves this by forcing the AI to act as a strict Compliance & Code-Doc Alignment Auditor right after a heavy coding sprint. It forces the agent to inspect its own runtime changes (git diff), lock down the project glossary, and recursively sync every markdown asset to match the absolute reality of the codebase.


🛠️ Installation

Manage it elegantly as a project dependency using Matt Pocock's declarative package manager workflow.

  1. In your project's root directory, create or update a skills.json file:
{
  "skills": [
    "nicecp/context-anchor"
  ]
}
  1. Run the official installer via your terminal to download and lock the version:
npx skills

This will automatically pull context-anchor.md into your local .claude/skills/ and .cursor/skills/ directories while generating a skills-lock.json file to keep your team or future AI agents completely aligned on the exact same skill commit.


🎮 How to Use It

Once installed, your IDE's native AI agent will automatically index the skill. After any major coding implementation, refactoring session, or database schema change, simply type one of the following short commands into your AI chat box:

You: /anchor (or /audit)

🔄 The Lifecycle Architecture

When triggered, the AI execution flow pivots into a strict verification machine:

[Your Code Changes (Git Diff)] 
       │
       ▼
 1. RUNTIME AUDIT ────► (Checks Schema DDLs, units, constraints & boundary edge cases)
       │
       ▼
 2. GLOSSARY ENFORCE ──► (Prevents synonym fragmentation, updates central nomenclature)
       │
       ▼
 3. KNOWLEDGE SYNC ───► (Rewrites .claude/ or .cursor/ docs to mirror source code)
       │
       ▼
[Output: Doc-Compliance Divergence Report]


📋 Example Report Output

When the protocol finishes, your AI agent will present a structured summary so you know exactly what changed under the hood:

⚓ Context-Anchor Alignment Report

1. 🔍 Audit Discoveries

  • Database Schema: Detected new migration adding user_profiles. Verified composite unique index uk_user_tenant_id is correctly implemented in DDL.
  • Edge Defense: Confirmed the authentication state machine successfully implemented a Token Expiry Grace Period to prevent abrupt streaming disconnections during active sessions.

2. 🔏 Glossary Increments

  • Idempotency_Key: Locked definition to denote the unique UUIDv4 string passed in the X-Idempotency-Key header for order placement.
  • Graceful_Shutdown_Timeout: Added terminology mapped to the system level process signal handling ($SIGTERM \rightarrow 30s$ buffer).

3. 📂 Markdown Synchronization Matrix

Target Document Action Sync Details
memory/database.md 📝 Updated Synced new user profile table layouts, constraints, and field annotations.
memory/api-endpoints.md 📝 Updated Mapped newly created v2 REST billing endpoints and retired legacy v1 routes.
mcp/third-party-service.md ❌ Deprecated Marked as obsolete due to full migration to the in-house internal service.

4. 🚦 Residual Downstream Risks

  • Rate-Limiting: The newly introduced webhooks retry mechanism relies on exponential backoff. Watch out for message queues clogging under cluster peak traffic.

💡 Best Practices for Vibe Coding

  • Run it Before Committing: Treat /anchor as your AI pre-commit hook. Never merge a feature branch without letting the agent sync its memory assets first.
  • Avoid Manual Doc Edits: Let the code drive the documentation. Write your code, implement your types/schemas, and let context-anchor propagate those realities back to your markdown specs.
  • Glossary Rigidity: If your agent starts hallucinating or using colloquial variable names, run /anchor immediately to snap its linguistic focus back to the project standard.

📄 License

MIT License. Feel free to use, modify, and contribute to keeping AI context pinned down to reality!

About

A strict compliance and code-doc alignment auditor for AI-native development to eliminate Context Drift and enforce final consistency.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors