Skip to content
Back to skills

Context Anchor

ASecurity

Set and maintain a persistent core topic or purpose for the entire AI session. Use when the user sets a core topic, anchors context, says "let's focus on X", "today we're building Y", "we're working on Z", or asks the assistant to stay on track across a long task.

  • 16 stars
  • 0 votes
  • 0 copies
  • 3 views
  • Added September 9, 2026
ai-agentspythonbashreactapidatabasefrontendbackend

Works with

  • api

Security analysis

A100/100

Pro scans all 3 files and shows the line behind each finding

Scanned September 9, 2026

npx -y skills add onfire7777/universal-ai-skills-library --skill context-anchor --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Context Anchor?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Context Anchor
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/onfire7777-context-anchor/badge)](https://www.skillsdirectory.com/skills/onfire7777-context-anchor)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: context-anchor
description: Set and maintain a persistent core topic or purpose for the entire AI session. Use when the user sets a core topic, anchors context, says "let's focus on X", "today we're building Y", "we're working on Z", or asks the assistant to stay on track across a long task.
---

# Context Anchor

Persistent attention anchoring for long AI sessions. Externalizes the core session purpose to `~/.context_anchor.md` and enforces periodic recitation to maintain focus across many tool calls, preventing drift from tangential requests.

## Activation

Detect **explicit** triggers: user says "set anchor", "anchor this", "core topic is", "focus on".
Detect **implicit** triggers: user frames session purpose with "today we're building X", "let's work on Y", "this project is about Z". Summarize the detected intent and confirm with the user before setting.

On session start, check if `~/.context_anchor.md` exists. If it does, run `anchor.py show` immediately and recite the anchor to orient yourself.

## Quick Start

```bash
# Set anchor with full context
python3 /home/ubuntu/skills/context-anchor/scripts/anchor.py set "Building a SaaS analytics dashboard" \
  -o "Design database schema" "Build REST API" "Create React frontend" \
  -b "No mobile app" "No payment processing" \
  -s "All CRUD endpoints work" "Dashboard renders real-time metrics"

# View current anchor
python3 /home/ubuntu/skills/context-anchor/scripts/anchor.py show

# Check if a sub-task aligns with the anchor (AI-powered relevance scoring)
python3 /home/ubuntu/skills/context-anchor/scripts/anchor.py check "Should I add Stripe integration?"
```

## Recitation Discipline

This is the most critical behavior. You MUST enforce periodic recitation to keep the anchor in your active attention window.

**Every 5-10 tool calls** (aim for ~7), run `anchor.py show` and mentally reaffirm: "My core focus is [anchor topic]." If a `todo.md` also exists, recite both together - anchor first (WHY), then todo (WHAT). If 10 tool calls elapse without recitation, force an immediate refresh.

On recitation failure (file missing or inaccessible), fall back to your last known anchor from memory. Log the failure silently and retry next interval. Notify the user only if the anchor file is persistently unavailable.

## Handling Tangential Requests

When the user sends a request that diverges from the anchor:

1. Run `anchor.py check "user's request"` if relevance is unclear.
2. If the score is below 5/10 (divergent), acknowledge: "I notice this diverges from our core focus on [anchor topic]. I'll handle this, then return to the main thread."
3. Fulfill the request completely - the user always has final authority over the anchor.
4. After completing the tangent, explicitly restate the anchor: "Returning to our core focus: [anchor topic]."

Never refuse a user request because of the anchor. The anchor is a guide, not a constraint.

## Evolving the Anchor

As projects progress, refine the anchor rather than clearing it:

```bash
# Add a new objective
python3 /home/ubuntu/skills/context-anchor/scripts/anchor.py update --add-objective "Implement WebSocket for real-time updates"

# Add a boundary
python3 /home/ubuntu/skills/context-anchor/scripts/anchor.py update --add-boundary "Skip authentication for MVP"

# Narrow focus to current phase
python3 /home/ubuntu/skills/context-anchor/scripts/anchor.py update --refine "Phase 2: Backend API development for the analytics dashboard"
```

Confirm with the user before making anchor changes. Do not update more than once per 3 tool calls to prevent instability.

## Integration with todo.md

The anchor and `todo.md` are complementary:

| File | Purpose | Contains |
|---|---|---|
| `~/.context_anchor.md` | WHY - the overarching purpose | Core topic, objectives, boundaries, success criteria |
| `todo.md` | WHAT - the specific tasks | Current tasks, progress, next steps |

When both exist, recite them together during periodic recitation. On anchor changes, review `todo.md` to ensure task alignment with the updated purpose.

## Commands Reference

| Command | Usage |
|---|---|
| `set` | `anchor.py set "topic" [-o objectives...] [-b boundaries...] [-s success...]` |
| `show` | `anchor.py show` |
| `check` | `anchor.py check "message to evaluate"` |
| `update` | `anchor.py update [--add-objective text] [--add-boundary text] [--refine text]` |
| `history` | `anchor.py history` |
| `clear` | `anchor.py clear` |

## Advanced Patterns

For deep insights into why anchoring works, recitation schedules by session length, drift detection patterns, multi-layer anchoring, and anchor conflict resolution, read: `/home/ubuntu/skills/context-anchor/references/attention_patterns.md`

Files in this skill

  • SKILL.md4.6 KB
  • references/attention_patterns.md2.9 KB
  • scripts/anchor.py19 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…