Add insights-context skill with cross-referenced friction resolution - #1
Merged
Conversation
Rebased onto latest fork/main (which already had several of the hardening
fixes: /home/ + /root redaction, secure mkstemp, CSS injection defense,
subprocess timeouts, xdg-open on Linux). The remaining five correctness
and redaction bugs are fixed here:
- scan.py: parse_ts normalizes tz-aware -> naive UTC so mixed streams don't
crash on subtraction on Python 3.11+. is_err filters negated forms
("no error", "error: none", "0 errors") and word-bounds the "error:"
marker so successful tool results don'"'"'t pollute friction. Added a
bare-token secret redaction pattern catching traceback values like
`api_key abc123...` that the =/: form misses.
- resolve.py: fixed_at picks dates anchored to fix keywords in prose
(fixed/resolved/patched/landed/merged/shipped) over naive last-position,
so "originally seen X, fixed Y" picks the right date. Git-log parser
handles empty commit bodies (4-field split padded to 5 so fix commits
with no body still classify).
- render.py: cross_reference no longer breaks on first match — collects
all matches and prefers entries with a real fixed_at so a later dated
entry beats an earlier undated one, restoring the documented
"Match + friction before fix -> RESOLVED" invariant.
- test_smoke.py: synthesizes a temp git repo with a baseline + fix commit
touching OnDemandVerificationStore.swift, dated after the fixture
friction so the RESOLVED classifier asserts a real path instead of
relying on the host repo happening to contain that file. atexit cleanup.
Co-Authored-By: GLM 5.2 [1m] <noreply@anthropic.com>
RasputinKaiser
force-pushed
the
skill/insights-context
branch
from
June 25, 2026 05:42
8ce23ad to
43b8709
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a new user-installed skill,
/insights-context, that produces a context-aware HTML insights report mirroring the bundled/insightscommand, but cross-references friction signals against git history + auto-memory so resolved issues are not reported as currently broken.The skill ships three project-agnostic Python scripts under
skills/insights-context/scripts/:scan.py— walks NCode session JSONLs into friction + stats JSONresolve.py— builds resolved + environmental ledger from memory files and git logrender.py— cross-references scan output against the resolved ledger, emits a standalone HTML reportcompare.py— delta view between two scan windows (for--compare)test_smoke.py— end-to-end fixture test with zero-identity-leak assertionsClassifier
The resolver matches friction topics to resolved entries using signal-based keys (file paths, commit hashes, code symbols) with three confidence tiers:
Informational interrupts (user adds context or preference mid-task) are tracked separately from friction so they don't inflate the friction count.
Redaction
All paths and snippets are scrubbed before emission: home directory →
~, bare username →<redacted>, API keys / tokens / Artifactory URLs / basic-auth URLs →<redacted-*>, GitHub noreply emails (12345+handle@users.noreply.github.com) →<redacted-github-email>,/users/<numeric-id>profile URLs →<redacted-github-url>. Optional per-user tokens load from~/.ncode/identity-redact.txt.Latest commit — bug fixes from deep review
The third commit (
8ce23ad) fixes correctness, redaction, and test-isolation issues found in a focused review of the scripts:render.py— classifier no longer breaks on first match. It iterates all resolved entries and prefers ones with a realfixed_atso an undated early match cannot shadow a later dated entry (restoring the documented "Match + friction before fix → RESOLVED" invariant).resolve.py—fixed_atnow picks dates anchored to fix keywords (fixed/resolved/patched/landed/merged/shipped) in prose over naive last-position, so "originally seen X, fixed Y" picks the right date. Git-log parser handles empty commit bodies (4-field split no longer rejected).scan.py—parse_tsnormalizes tz-aware timestamps to naive UTC so mixed aware/naive streams no longer crash on subtraction.is_errfilters negated forms ("no error", "error: none") and word-bounds theerror:marker. Added a bare-token secret redaction pattern catching values likeapi_key abc123...that the=/:form misses.OTHER_USERS_REalso scrubs/home/<name>/on Linux.render.py—opensubprocess is cross-platform (xdg-openon Linux,openon macOS).test_smoke.py— synthesizes its own temp git repo with a baseline + fix commit touchingOnDemandVerificationStore.swift, dated after the fixture friction, so the RESOLVED assertion exercises a real classifier path instead of relying on the host repo happening to contain that file. Removeslstrip("-")so the memory-dir path keeps its leading dash.Test plan
python3 test_smoke.pypasses end-to-end (scan → resolve → render → leak scan)/insights-contextrun on this repo: 13 sessions scanned, 9 OPEN / 1 RESOLVED / 0 REGRESSIONS, zero identity leaks in rendered HTMLpython3 -c "import ast; [ast.parse(open(f).read()) for f in [...]]"grep -iE "noreply.github|/users/[0-9]" /tmp/insights-context-*.htmlreturns zero matchesNotes
skills/. It does not modify any core CLI code, build, or test path. Defaultbun install && bun run buildis unaffected.cwd/argv, none are hardcoded.