icpg
БесплатноБез исполняемых скриптовНе проверенIntent-Augmented Code Property Graph — tracks WHY code exists via ReasonNodes with formal contracts, 6-dimension drift detection, and 3 canonical pre-task…
от alinaqi★ 713 звёзд на GitHubОб этом скилле
iCPG Skill (Intent-Augmented Code Property Graph)
Purpose: Add a Reason Graph layer on top of code structure so every function, class, and module is traceable to the goal that created it, the agent or human that owns it, and whether it's still doing what it was supposed to do.
┌────────────────────────────────────────────────────────────────┐
│ iCPG = AST + CFG + PDG + RG (Reason Graph) │
│ ─────────────────────────────────────────────────────────────│
│ AST = Abstract Syntax Tree (structure) ← existing │
│ CFG = Control Flow Graph (execution paths) ← existing │
│ PDG = Program Dependency Graph ← existing │
│ RG = Reason Graph (WHY layer) ← THIS SKILL │
│ │
│ The RG stores ReasonNodes (goals/tasks), links them to code │
│ symbols via typed edges, enforces contracts (DbC), and │
│ detects when code drifts from its original purpose. │
│ │
│ Storage: .icpg/reason.db (SQLite, per-project, gitignored) │
│ CLI: icpg init | create | record | query | drift | bootstrap │
└────────────────────────────────────────────────────────────────┘
Core Principle
Intent first, code second. Before writing or modifying code, query the reason graph to understand WHY existing code was written, WHAT constraints it must preserve, and WHETHER your change duplicates prior work.
The 3 Canonical Pre-Task Queries
Every agent MUST run these before writing code:
| # | Query | Command | What It Answers |
|---|---|---|---|
| 1 | search_prior_work | icpg query prior "<goal>" |
Has this been attempted before? Prevents duplication. |
| 2 | get_constraints | icpg query constraints <file> |
What invariants apply to files I'll touch? Prevents breakage. |
| 3 | get_risk_profile | icpg query risk <symbol> |
Is this symbol fragile? Drift history, ownership changes. |
ReasonNode — The Core Primitive
Each ReasonNode captures a stated purpose with a formal contract:
id UUID
goal Natural language: what is this trying to achieve
decision_type business_goal | arch_decision | task | workaround | constraint | patch
scope Files/modules expected to be touched
owner Human or agent accountable
status proposed | executing | fulfilled | drifted | abandoned
source manual | commit | inferred | agent-session
FORMAL CONTRACT (Design by Contract):
preconditions What must be true before this intent executes
postconditions What must be true when fulfilled
invariants What must remain true throughout and after
Drift = predicate failure. A symbol has drifted when its current behavior no longer satisfies the postconditions of the ReasonNode that created it, or when an invariant is violated.
Six Edge Types
CREATES Reason → Symbol (this intent created this function)
MODIFIES Reason → Symbol (this intent changed this function)
REQUIRES Reason → Reason (B depends on A being done first)
DUPLICATES Reason → Reason (these two goals overlap)
VALIDATED_BY Reason → Test (this test proves the intent was satisfied)
DRIFTS_FROM Symbol → Reason (this symbol no longer does what it was made for)
6-Dimension Drift Model
| Dimension | What It Means | Detection |
|---|---|---|
| Spec drift | Symbol checksum changed without a MODIFIES edge | Compare stored vs current checksum |
| Decision drift | Postconditions no longer hold | Evaluate predicates against codebase |
| Ownership drift | >3 different owners without coherent oversight | Count unique owners on edges |
| Test drift | VALIDATED_BY tests missing or failing | Check test file existence + run |
| Usage drift | Symbol used outside original scope | Grep for imports beyond scope |
| Dependency drift | Downstream REQUIRES reasons have drifted | Traverse REQUIRES edges |
Run icpg drift check to scan all dimensions. Each produces a 0-1 severity score.
CLI Reference
Setup
icpg init # Create .icpg/ and database
icpg bootstrap --days 90 # Infer ReasonNodes from git history
icpg bootstrap --days 90 --no-llm # Without LLM (commit-message only)
Create & Record
icpg create "Add JWT auth" --scope src/auth/ --owner feature-auth --type task
icpg record --reason <id> --base main # Record symbols from git diff
icpg record --reason <id> --edge-type MODIFIES # Record as modifications
Query (the 3 canonical queries)
icpg query prior "user authentication" # 1. Duplicate detection
icpg query constraints src/auth/service.ts # 2. Invariants for file
icpg query risk validateToken # 3. Symbol risk profile
icpg q
Установить icpg в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
FAQ
Что делает скилл icpg?
Intent-Augmented Code Property Graph — tracks WHY code exists via ReasonNodes with formal contracts, 6-dimension drift detection, and 3 canonical pre-task queries for autonomous development
Как установить скилл icpg?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл icpg запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
mcp-builder
Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when…
от Anthropicclaude-api
Reference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER…
от Anthropicalgorithmic-art
Creating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code…
от Anthropicmcp-integration
This skill should be used when the user asks to "add MCP server", "integrate MCP", "configure MCP in plugin", "use .mcp.json", "set up Model Context…
от Anthropic