一键导入
context-mutation
Create and modify AIKnowSys sessions and plans using mutation commands
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Create and modify AIKnowSys sessions and plans using mutation commands
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Archive completed plans and clean workspace using CLI commands
Query up-to-date 3rd-party framework/library documentation using Context7 MCP
Query AIKnowSys knowledge system (READ operations only - plans, sessions, context search)
AI-assisted workflow for sharing personal patterns with the team. Detects valuable patterns, checks duplicates, and guides sharing decisions.
Review AIKnowSys deliverables (skills, stack templates, documentation) using Context7 MCP for current framework documentation. Use for monthly quality reviews, pre-release validation, or when frameworks release major versions.
Template for creating new skills following VS Code Agent Skills standard
| name | context-mutation |
| description | Create and modify AIKnowSys sessions and plans using mutation commands |
| triggers | ["create session","update session","create plan","document work","record completion","session notes","log progress","mark session complete","add topic to session","link file to session"] |
| maintainer | false |
#Context Mutation Skill
Use this skill when you need to:
Benefits:
Manual file editing problems:
Mutation command benefits:
Create a new session file with YAML frontmatter:
# Create session with topics
npx aiknowsys create-session --topics "TDD,validation" --plan PLAN_context_query
# Create with custom title
npx aiknowsys create-session --title "Bug Fix Session" --topics "debugging"
# JSON output (for AI agents)
npx aiknowsys create-session --topics "refactor" --json
Options:
--topics <topics> - Comma-separated topics (e.g., "TDD,validation")--plan <plan> - Link to active plan (e.g., PLAN_xyz)--title <title> - Session title (default: "Work Session")--json - Structured JSON outputJSON Output:
{
"filePath": ".aiknowsys/sessions/2026-02-07-session.md",
"created": true,
"metadata": {
"date": "2026-02-07",
"topics": ["TDD", "validation"],
"plan": "PLAN_context_query",
"title": "Work Session"
}
}
When to use:
Modify today's session metadata:
# Add topic
npx aiknowsys update-session --add-topic "TypeScript"
# Add file
npx aiknowsys update-session --add-file "lib/commands/create-plan.ts"
# Mark complete
npx aiknowsys update-session --set-status complete
# Multiple updates
npx aiknowsys update-session \
--add-topic "debugging" \
--add-file "lib/context/auto-index.ts" \
--set-status complete
Options:
--add-topic <topic> - Add topic to session (no duplicates)--add-file <file> - Add file to session (no duplicates)--set-status <status> - Set session status (in-progress | complete | abandoned)--appendSection <title> - Add markdown section header at end (e.g., "## Notes")--content <text> - Section body content (requires section option)--appendFile <path> - Append content from markdown file--prependSection <title> - Add section at beginning (after frontmatter)--insert-after <pattern> - Insert section after matching pattern--insert-before <pattern> - Insert section before matching pattern--json - Structured JSON outputShortcuts (v0.11.0):
--done - Shortcut for --set-status complete--wip - Shortcut for --set-status in-progress--append <content> - Shortcut for --appendSection "Update" + auto-detect content/file
/ or .md), reads from fileCommand Aliases (v0.11.0):
# Ultra-short commands for common operations
npx aiknowsys done # → update-session --done
npx aiknowsys wip # → update-session --wip
npx aiknowsys log "message" # → update-session --append "message"
Features:
When to use:
Append section with inline content:
npx aiknowsys update-session \
--appendSection "## Work Complete" \
--content "Finished all polishing items.\n\nTests passing: 963/969"
Append content from file:
npx aiknowsys update-session --appendFile meeting-notes.md
Combine metadata + content updates:
npx aiknowsys update-session \
--add-topic "polishing" \
--set-status complete \
--appendSection "## Summary" \
--content "Completed all enhancements."
Shortcuts (v0.11.0):
# Mark complete (shortcut)
npx aiknowsys update-session --done
# → Same as: --set-status complete
# Quick note with auto-detection
npx aiknowsys update-session --append "Fixed validation bug"
# → Creates "## Update" section with content
# Auto-detect file path
npx aiknowsys update-session --append ./notes.md
# → Reads file and appends (auto-detected from path)
# Ultra-short command aliases
npx aiknowsys done # Mark complete
npx aiknowsys wip # Mark in-progress
npx aiknowsys log "Fixed bug #123" # Quick note
Advanced Insertion (Phase 1):
# Prepend section at beginning (after frontmatter)
npx aiknowsys update-session \
--prependSection "## Critical Issue" \
--content "Security vulnerability found"
# Insert section after specific pattern
npx aiknowsys update-session \
--insert-after "## Goal" \
--appendSection "## Implementation" \
--content "Steps taken..."
# Insert section before specific pattern
npx aiknowsys update-session \
--insert-before "## Notes" \
--appendSection "## Changes" \
--content "List of changes..."
When to use advanced insertion:
Generate implementation plan with active pointer:
# Create plan
npx aiknowsys create-plan --title "API Redesign"
# With custom author
npx aiknowsys create-plan --title "Performance Fix" --author jane-dev
# With topics
npx aiknowsys create-plan --title "TypeScript Migration" --topics "migration,types"
# JSON output
npx aiknowsys create-plan --title "Feature X" --json
Options:
--title <title> - Plan title (REQUIRED)--author <author> - Plan author (auto-detected from git config)--topics <topics> - Comma-separated topics--json - Structured JSON outputWhat it creates:
.aiknowsys/PLAN_{title_normalized}.md.aiknowsys/plans/active-{author}.mdJSON Output:
{
"planId": "PLAN_api_redesign",
"filePath": ".aiknowsys/PLAN_api_redesign.md",
"activePointer": ".aiknowsys/plans/active-arno.md",
"created": true
}
When to use:
Modify plan status and progress (v0.12.0):
# Activate a plan
npx aiknowsys update-plan PLAN_feature_xyz --set-status ACTIVE
# Auto-detect plan from active pointer
npx aiknowsys update-plan --set-status PAUSED
# Add progress note
npx aiknowsys update-plan PLAN_feature_xyz --append "Phase 1 complete: all tests passing"
# Complete plan with final notes
npx aiknowsys update-plan PLAN_feature_xyz \
--set-status COMPLETE \
--append "Feature deployed to production"
# Append progress from file
npx aiknowsys update-plan PLAN_feature_xyz --append-file ./sprint-notes.md
# JSON output
npx aiknowsys update-plan PLAN_feature_xyz --set-status ACTIVE --json
Options:
[planId] - Plan identifier (PLAN_xyz) or omit to auto-detect from active pointer--set-status <status> - Set plan status (PLANNED|ACTIVE|PAUSED|COMPLETE|CANCELLED)--append <content> - Inline progress note to append (auto-timestamped)--append-file <file> - Path to file containing progress notes to append--author <author> - Plan author for auto-detection (defaults to git user)--json - Structured JSON outputShortcut Commands (v0.12.0):
# Ultra-short commands for common status changes
npx aiknowsys plan-activate PLAN_xyz # → update-plan --set-status ACTIVE
npx aiknowsys plan-complete PLAN_xyz # → update-plan --set-status COMPLETE
npx aiknowsys plan-pause PLAN_xyz # → update-plan --set-status PAUSED
npx aiknowsys plan-cancel PLAN_xyz # → update-plan --set-status CANCELLED
What it does:
.aiknowsys/plans/active-{author}.md)Status Transitions:
PLANNED → ACTIVE: Adds started date, creates active pointerACTIVE → PAUSED: Keeps pointer, no date changePAUSED → ACTIVE: Restores pointerACTIVE → COMPLETE: Adds completed date, clears pointer* → CANCELLED: Adds completed date, clears pointerJSON Output:
{
"planId": "PLAN_feature_xyz",
"filePath": ".aiknowsys/PLAN_feature_xyz.md",
"updated": true,
"changes": [
"Status: PLANNED → ACTIVE",
"Added progress note"
]
}
When to use:
Key Benefits:
Scenario: You just finished implementing a feature and want to document it.
Old way (manual editing):
1. Detect: "document work" → No trigger, skill not loaded
2. Use replace_string_in_file on .aiknowsys/sessions/YYYY-MM-DD-session.md
3. Manually format YAML frontmatter (error-prone)
4. No validation, no index rebuild
5. Harder and riskier
New way (mutation commands):
1. Detect: "document work" → context-mutation skill loaded
2. Follow skill guidance:
npx aiknowsys update-session \
--add-topic "feature-implementation" \
--add-file "lib/commands/new-feature.ts" \
--set-status complete \
--json
3. Command validates YAML, rebuilds index
4. ✅ Easier, safer, faster
Scenario: Starting work for the day, session doesn't exist yet.
# Create session linked to active plan
npx aiknowsys create-session \
--topics "TypeScript,migration" \
--plan PLAN_typescript_migration \
--title "Day 2: Migrate lib/ directory" \
--json
Output:
{
"filePath": ".aiknowsys/sessions/2026-02-07-session.md",
"created": true,
"metadata": {
"date": "2026-02-07",
"topics": ["TypeScript", "migration"],
"plan": "PLAN_typescript_migration",
"title": "Day 2: Migrate lib/ directory"
}
}
Next steps:
# Mark session complete with topics/files
npx aiknowsys update-session \
--add-topic "refactoring" \
--add-topic "testing" \
--add-file "lib/commands/update-session.ts" \
--add-file "test/update-session.test.ts" \
--set-status complete \
--json
# Add topic as you start new workstream
npx aiknowsys update-session --add-topic "debugging"
# Add file as you modify it
npx aiknowsys update-session --add-file "lib/context/auto-index.ts"
# Mark complete when done
npx aiknowsys update-session --set-status complete
# 1. Create plan at start of feature
npx aiknowsys create-plan --title "Session Mutation Workflow" --json
# 2. Create daily sessions linked to plan
npx aiknowsys create-session \
--topics "mutation-commands,session-management" \
--plan PLAN_session_mutation_workflow \
--json
# 3. Update session as work progresses
npx aiknowsys update-session \
--add-file "lib/commands/update-session.ts" \
--set-status complete
For querying existing sessions/plans, see:
npx aiknowsys query-sessions --days 7 --json - Recent sessionsnpx aiknowsys query-plans --status ACTIVE --json - Active plansAll mutation commands support --json flag for structured output:
Benefits:
Example JSON response:
{
"success": true,
"action": "update-session",
"filePath": ".aiknowsys/sessions/2026-02-07-session.md",
"changes": {
"topicsAdded": ["TypeScript"],
"filesAdded": ["lib/commands/new.ts"],
"statusChanged": "complete"
},
"indexRebuilt": true
}
Invalid status value:
$ npx aiknowsys update-session --set-status invalid
Error: Invalid status. Must be one of: in-progress, complete, abandoned
Session doesn't exist (update-session):
$ npx aiknowsys update-session --add-topic "testing"
Error: No session file found for today (2026-02-07).
Create one first: npx aiknowsys create-session --topics "testing"
Missing required option:
$ npx aiknowsys create-plan
Error: required option '--title <title>' not specified
update-session to modify session filesreplace_string_in_file on .aiknowsys/sessions/--json flag in AI agent workflowscreate-session with topics/planupdate-session --add-topic/file as you workupdate-session --set-status completeProblem: "Session file already exists"
update-session instead of create-sessionProblem: "Index out of sync"
npx aiknowsys rebuild-index (mutation commands do this automatically)Problem: "YAML frontmatter invalid"
Problem: "Duplicate topics/files added"
After using mutation commands:
npx aiknowsys query-sessions --days 1 --json to confirm session indexedPart of AIKnowSys v0.10.0+ mutation workflow. See also: context-query, AGENTS.md