From kmgraph
Add a new category to an existing knowledge graph with optional custom prefix
npx claudepluginhub technomensch/knowledge-graph --plugin kmgraph# /kmgraph:add-category — Add Category to Knowledge Graph Add a new category to the active knowledge graph with optional custom prefix and git strategy. ## Syntax ## What This Does 1. Prompts for category name (if not provided) 2. Asks for optional prefix 3. Asks for git strategy (commit or ignore) 4. Creates `lessons-learned/[category]/` directory 5. Creates `knowledge/[category].md` if needed 6. Updates config with new category 7. Updates `.gitignore` if strategy is ignore ## Implementation ### Wizard Prompts ### Create Directories ### Create KG Entry File ### Update Conf...
Add a new category to the active knowledge graph with optional custom prefix and git strategy.
/kmgraph:add-category
/kmgraph:add-category security
/kmgraph:add-category ml-ops --prefix ml- --git ignore
lessons-learned/[category]/ directoryknowledge/[category].md if needed.gitignore if strategy is ignoreCategory name: security
Prefix (optional, e.g., "sec-"): sec-
Git strategy (commit/ignore): ignore
# Get active KG path from config
kg_path=$(jq -r '.graphs[.active].path' ~/.claude/kg-config.json)
mkdir -p "$kg_path/lessons-learned/$category"
if [ ! -f "$kg_path/knowledge/${category}.md" ]; then
cp "${CLAUDE_PLUGIN_ROOT}/core/templates/knowledge/entry-template.md" \
"$kg_path/knowledge/${category}.md"
fi
jq ".graphs[.active].categories += [{\"name\": \"$category\", \"prefix\": \"$prefix\", \"git\": \"$git_strategy\"}]" \
~/.claude/kg-config.json > ~/.claude/kg-config.json.tmp
mv ~/.claude/kg-config.json.tmp ~/.claude/kg-config.json
if [ "$git_strategy" == "ignore" ] && [ -f .gitignore ]; then
echo "knowledge/lessons-learned/$category/" >> .gitignore
echo "knowledge/${category}.md" >> .gitignore
fi
/kmgraph:init — Initialize new KG/kmgraph:list — View all KGs and their categories