with one click
ccg-annotate
// code-context-graph — AI-driven annotation workflow. Add @intent/@domainRule/etc to code so search and RAG can find by business meaning.
// code-context-graph — AI-driven annotation workflow. Add @intent/@domainRule/etc to code so search and RAG can find by business meaning.
[HINT] Download the complete skill directory including SKILL.md and all related files
| name | ccg-annotate |
| description | code-context-graph — AI-driven annotation workflow. Add @intent/@domainRule/etc to code so search and RAG can find by business meaning. |
Add structured business metadata to code. This is what makes search and RAG actually useful.
@intent payment processingWithout annotations, ccg delivers only half its value.
| Tag | WHAT vs WHY | Example |
|---|---|---|
@intent | WHY this function exists | verify identity before granting access |
@domainRule | Specific business rule | lock account after 5 failures |
@sideEffect | Real side effects (DB/network/file) | writes to audit_log |
@mutates | State changes | user.FailedAttempts, session.Token |
@requires | Precondition | user.IsActive == true |
@ensures | Postcondition | returns valid JWT with 24h expiry |
@index | One-line file/package summary | User authentication service |
@see | Related function or CCG ref | SessionManager.Create, ccg://auth-svc/internal/auth/token.go#ValidateToken |
Annotations are retrieval features, but they must stay truthful. Use the
specific tag that matches the code's role instead of stuffing keywords into
@intent.
| When you see this | Add this |
|---|---|
| File/package/module should be found as one unit | @index |
| Public function, handler, CLI command, service method, or UI workflow has a clear purpose | @intent |
| Policy, constraint, operational rule, or false-positive/false-negative criterion matters | @domainRule |
| DB/file/network/cache/log/process side effect exists | @sideEffect |
| Receiver or input state changes | @mutates |
| Caller-facing input/output contract matters | @requires, @ensures |
| Related implementation must be followed, especially across namespaces | @see |
Good retrieval annotations include the words a developer or LLM would naturally
use to ask for the code, while matching the implementation. For example, if a
graph component focuses a resolved ccg:// node, say graph viewer, ccg ref,
and node focus in the appropriate @index/@intent. Do not add unrelated
terms just to raise score; broad terms make the wrong files rank higher.
/ccg-annotate annotate <path>)This is an agent skill workflow, not a ccg CLI subcommand. The CLI provides
ccg example <language> and ccg tags for writing guidance; the agent reads
and edits code directly.
Read the code and determine:
@index when the file itself is a useful search target@intent for meaningful public/workflow entry points@domainRule (must be specific)@sideEffect@mutates@requires, @ensures when they matterFor cross-namespace behavior, explain the reason in the semantic tag and put the target in @see:
// @sideEffect records token validation audit in auth-svc.
// @see ccg://auth-svc/internal/audit/token_audit.go#RecordTokenAudit
//, #)ccg build . # re-index with annotations
❌ Bad annotation:
// @intent creates a user
func CreateUser(...) {}
WHAT only. Function name already tells you that.
✅ Good annotation:
// @intent register new account for onboarding flow
// @domainRule email must be unique across all tenants
// @domainRule password must satisfy NIST 800-63B
// @sideEffect sends verification email
// @mutates users table, audit_log
func CreateUser(...) {}
WHY + business rules + side effects. Search and RAG become powerful.
Don't annotate everything. Prioritize:
Use ccg lint unannotated category and pick top-priority functions from there.
After adding annotations for a feature area, run a few natural-language retrieve/search probes that match how an LLM or engineer would ask:
ccg build .
ccg search "graph viewer ccg ref node focus"
For MCP/Web UI retrieval, use retrieve_docs or the Wiki Retrieve mode. If the
expected file is missing, prefer improving the precise @index, @intent,
@domainRule, or @see evidence on that file over changing global scoring.
Once annotated, ccg search indexes annotation text alongside code (see /ccg skill):
ccg search "결제" # finds functions with "결제" in @intent (Korean)
ccg search "lock" # finds functions with "lock" in @domainRule
| Tool | Use |
|---|---|
get_annotation | Fetch annotation/doc tags for a node |
Requires ccg build . first. (See /ccg skill.)