Getting it into your agent
One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.
npx skills add wefio/NodeMemoryGraph --skill complexity-reductiongit clone --depth 1 https://github.com/wefio/NodeMemoryGraphWrote this? Show the measurements
A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.
[](https://agentmods.dev/skills/wefio/nodememorygraph/complexity-reduction)<a href="https://agentmods.dev/skills/wefio/nodememorygraph/complexity-reduction"><img src="https://agentmods.dev/badge/skills/wefio/nodememorygraph/complexity-reduction/github.svg" alt="Measured on agentmods" height="20"></a>Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.
<a href="https://agentmods.dev/skills/wefio/nodememorygraph/complexity-reduction"><img src="https://agentmods.dev/badge/skills/wefio/nodememorygraph/complexity-reduction.svg" alt="Reviewed on agentmods" width="80" height="20"></a>What it costs to keep this loaded
Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.00050 | $0.01279 |
| Opus 5 | $0.00025 | $0.00639 |
| Sonnet 5 | $0.00010 | $0.00256 |
| Haiku 4.5 | $0.00005 | $0.00128 |
Grade A, and why
complexity-reduction scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 8d ago.
A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.
Nothing flagged
None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.
How it starts
The opening of the file, as written. The whole thing — 144 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Complexity reduction
Cyclomatic complexity counts linearly independent paths through a method: every
if, else if, for, while, case, catch, &&, ||, and ?: adds one.
High complexity means many paths to test and maintain. CodeFactor enforces a
threshold on the PR diff; the local
complexity:gate does the same before push.
When to use
- CodeFactor reports
Complex Methodon your PR. npm run complexity:gatefails (a changed method grew, or a new method exceeds the cap).- You are about to add branching to an already-large method.
Diagnose first
Identify which methods are over the threshold and whether you introduced them:
npx eslint --rule '{"complexity": ["error", 15]}' <file> # per-method complexity
git show <base>:<file> | npx eslint --stdin --stdin-filename <file> \
--rule '{"complexity": ["error", 15]}' # baseline (was it already complex?)
If a flagged method is unchanged from the baseline it is pre-existing debt, but CodeFactor still requires it under the threshold when the file is in the diff — reduce it anyway (it is a reviewable improvement, not a no-op).
The four techniques (in order of value)
1. Guard clauses (fail fast, keep the main path linear)
Replace nested if trees with early returns. This is the single biggest win.
// Before — arrow anti-pattern (deep nesting)
function collect(exec, result) {
const name = exec && exec.name
if (name) {
const fileIndex = ctx.get('fileIndex')
if (fileIndex && typeof fileIndex.addScopePath === 'function') {
// ... work
}
}
}
// After — linear flow
function collect(exec, result) {
const name = exec && exec.name
if (!name) return
const fileIndex = ctx.get('fileIndex')
if (!fileIndex || typeof fileIndex.addScopePath !== 'function') return
// ... work at one nesting level
}
2. Composed functions (extract one thing per function)
If a function does multiple things — often signalled by comment blocks like
// Step 2: ... — extract each into a small helper. The caller becomes
orchestration; each helper has few branches.
What this file has done since we first saw it
Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.
- 8d ago First seen · 144 lines · 50 tokens per session scan A 66faccfcf922
complexity-reduction is a skill published in the GitHub repository wefio/NodeMemoryGraph (0 stars, last pushed today), licensed MIT. It adds 50 tokens to every session and 1,279 once invoked, about $0.0003 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-04.
Other skills, from other repositories
pre-pr
Prepare a Honcho change for a pull request to plastic-labs/honcho. Invoke before opening a PR, when drafting a PR body, when asked if a branch is PR-ready, or when filling the pull request template. Checks the linked issue, required tests and docs, then writes Description / Proofs / Fixes.
github-code-review
Review PRs: diffs, inline comments via gh or REST.
simplify-code
Sequential 3-lens cleanup of recent code changes.
test-driven-development
TDD: enforce RED-GREEN-REFACTOR, tests before code.
requesting-code-review
Pre-commit review: security scan, quality gates, auto-fix.
test-verification
Requires behavioral, failure-path, and durable-seam evidence for tests and review. Use when writing tests, reviewing test coverage, assessing behavioral test quality, or accepting high-risk behavior on test evidence.