Dianel555/DSkills / skills/agent-wiki
agent-wiki
UnverifiedIncremental LLM-friendly wiki generator for Obsidian note vaults. Use when: (1) Building wiki from notes, (2) Ingesting notes to wiki, (3) Obsidian LLM wiki, (4) Incremental knowledge base management. Triggers: 'build wiki from notes', 'ingest notes to wiki', 'Obsidian LLM wiki', 'incremental knowledge base'.
scripts/agent_wiki/keywords.py
View on GitHub"""Keyword inventory for topic categorization (read-only).
Surfaces per-keyword frequency and per-topic keyword lists so the Agent can
归纳 a small set of subject categories (e.g. 材料 / 器件 / 方法 …) and
assign each topic a ``topic_category``. No file writes, no LLM, no network.
"""
from __future__ import annotations
from typing import Any
from . import boundary, config, wiki_index
def compute_keywords(vault: str | Any) -> dict[str, Any]:
"""Inventory keywords across all indexed topics.
Returns:
{
"ok": True,
"keywords": [{"keyword": str, "count": int, "topics": [str]}, ...],
"uncategorized": [str], # topic keys with no keywords
}
``keywords`` is frequency-descending (NFC tiebreak), so the most common
terms the Agent should base categories on come first.
"""
boundary.bind(vault)
if not config.wiki_root(vault).exists():
raise ValueError("wiki_not_initialized")
data, _ = wiki_index.rebuild(vault)
freq: dict[str, dict[str, Any]] = {}
uncategorized: list[str] = []
for key, entry in data.get("topics", {}).items():
# Dedup within a topic (preserving order) and drop empty keywords so
# they neither inflate counts nor pollute the keyword set; a topic whose
# only keywords were empty/duplicate lands in uncategorized.
kws = list(dict.fromkeys(
str(k) for k in (entry.get("keywords") or []) if str(k).strip()
))
if not kws:
uncategorized.append(key)
continue
for kw in kws:
slot = freq.setdefault(kw, {"keyword": kw, "count": 0, "topics": []})
slot["count"] += 1
slot["topics"].append(key)
for slot in freq.values():
slot["topics"].sort()
keywords = sorted(freq.values(), key=lambda s: (-s["count"], s["keyword"]))
uncategorized.sort()
return {"ok": True, "keywords": keywords, "uncategorized": uncategorized}
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| reverse-engineer-anythingmorluto/reaReverse engineer native, managed, Electron/JavaScript, packaged, firmware, and browser targets with REA, and build agent environments (AgentEnv bundles) of web applications from a live instance or a capture, and of Linux desktop apps with a task from a request. Use shipped-artifact or requested runtime evidence to explain features, compare versions, decompile code, or guide a reconstruction. Skip REA for ordinary source-repository architecture analysis. | Stars: 471k | Updated | Claude CodeCodex | Verified | Install |
| diagnosing-superpowersobra/superpowersUse when a superpowers session went wrong and your human partner wants to know why — repeated work, ignored plans, stumbles, poor results, a skill that didn't fire, "it took too long", "why is it so expensive", "what is it doing" — or wants to build a bug report for the superpowers maintainers, for the current session or a past one identified by id or path, on any harness. | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| dispatching-parallel-agentsobra/superpowersUse when facing 2+ independent tasks that can be worked on without shared state or sequential dependencies | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| executing-plansobra/superpowersUse when executing an implementation plan in the current session as the implementer yourself — your human partner chose inline execution, or no subagent tool is available | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |