@krtclcdy/tersio 2.25.6 → 2.25.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +30 -7
- package/dist/bench/code-out/pfull-0/debounce.js +13 -0
- package/dist/bench/code-out/pfull-0/deepClone.js +18 -0
- package/dist/bench/code-out/pfull-0/groupBy.js +15 -0
- package/dist/bench/code-out/pfull-1/debounce.js +13 -0
- package/dist/bench/code-out/pfull-1/deepClone.js +17 -0
- package/dist/bench/code-out/pfull-1/groupBy.js +14 -0
- package/dist/bench/code-out/pfull-2/debounce.js +13 -0
- package/dist/bench/code-out/pfull-2/deepClone.js +18 -0
- package/dist/bench/code-out/pfull-2/groupBy.js +15 -0
- package/dist/bench/code-out/pfull-3/debounce.js +12 -0
- package/dist/bench/code-out/pfull-3/deepClone.js +17 -0
- package/dist/bench/code-out/pfull-3/groupBy.js +7 -0
- package/dist/bench/code-out/pfull-4/debounce.js +10 -0
- package/dist/bench/code-out/pfull-4/deepClone.js +17 -0
- package/dist/bench/code-out/pfull-4/groupBy.js +14 -0
- package/dist/bench/code-out/plite-0/debounce.js +13 -0
- package/dist/bench/code-out/plite-0/deepClone.js +18 -0
- package/dist/bench/code-out/plite-0/groupBy.js +15 -0
- package/dist/bench/code-out/plite-1/debounce.js +13 -0
- package/dist/bench/code-out/plite-1/deepClone.js +17 -0
- package/dist/bench/code-out/plite-1/groupBy.js +11 -0
- package/dist/bench/code-out/plite-2/debounce.js +12 -0
- package/dist/bench/code-out/plite-2/deepClone.js +17 -0
- package/dist/bench/code-out/plite-2/groupBy.js +14 -0
- package/dist/bench/code-out/plite-3/debounce.js +12 -0
- package/dist/bench/code-out/plite-3/deepClone.js +17 -0
- package/dist/bench/code-out/plite-3/groupBy.js +14 -0
- package/dist/bench/code-out/plite-4/debounce.js +12 -0
- package/dist/bench/code-out/plite-4/deepClone.js +17 -0
- package/dist/bench/code-out/plite-4/groupBy.js +14 -0
- package/dist/bench/code-out/pultra-0/debounce.js +12 -0
- package/dist/bench/code-out/pultra-0/deepClone.js +20 -0
- package/dist/bench/code-out/pultra-0/groupBy.js +14 -0
- package/dist/bench/code-out/pultra-1/debounce.js +10 -0
- package/dist/bench/code-out/pultra-1/deepClone.js +17 -0
- package/dist/bench/code-out/pultra-1/groupBy.js +7 -0
- package/dist/bench/code-out/pultra-2/debounce.js +13 -0
- package/dist/bench/code-out/pultra-2/deepClone.js +18 -0
- package/dist/bench/code-out/pultra-2/groupBy.js +15 -0
- package/dist/bench/code-out/pultra-3/debounce.js +13 -0
- package/dist/bench/code-out/pultra-3/deepClone.js +18 -0
- package/dist/bench/code-out/pultra-3/groupBy.js +15 -0
- package/dist/bench/code-out/pultra-4/debounce.js +13 -0
- package/dist/bench/code-out/pultra-4/deepClone.js +18 -0
- package/dist/bench/code-out/pultra-4/groupBy.js +15 -0
- package/dist/bench/code-out/run-0/debounce.js +12 -0
- package/dist/bench/code-out/run-0/deepClone.js +17 -0
- package/dist/bench/code-out/run-0/groupBy.js +14 -0
- package/dist/bench/code-out/run-1/debounce.js +13 -0
- package/dist/bench/code-out/run-1/deepClone.js +15 -0
- package/dist/bench/code-out/run-1/groupBy.js +13 -0
- package/dist/bench/code-out/run-2/debounce.js +12 -0
- package/dist/bench/code-out/run-2/deepClone.js +18 -0
- package/dist/bench/code-out/run-2/groupBy.js +13 -0
- package/dist/bench/code-out/run-3/debounce.js +12 -0
- package/dist/bench/code-out/run-3/deepClone.js +18 -0
- package/dist/bench/code-out/run-3/groupBy.js +14 -0
- package/dist/bench/code-out/run-4/debounce.js +12 -0
- package/dist/bench/code-out/run-4/deepClone.js +16 -0
- package/dist/bench/code-out/run-4/groupBy.js +13 -0
- package/dist/cli/banner.js +1 -2
- package/dist/cli/common.js +1 -1
- package/dist/cli/doctor.js +48 -12
- package/dist/cli/hosts.js +1 -2
- package/dist/cli/install.js +7 -2
- package/dist/cli/manifest.js +25 -5
- package/dist/cli/uninstall.js +1 -1
- package/dist/extensions/caveman/index.js +6 -2
- package/dist/extensions/caveman/rule-lite.md +77 -0
- package/dist/extensions/caveman/rule-megacave-lite.md +59 -0
- package/dist/extensions/caveman/rule-megacave-ultra.md +59 -0
- package/dist/extensions/caveman/rule.md +1 -1
- package/dist/extensions/combo/index.js +26 -7
- package/dist/extensions/pstack/index.js +3 -1
- package/dist/extensions/pstack/rule.md +88 -12
- package/dist/extensions/rtk/session.js +18 -10
- package/dist/extensions/shared/rtk-eligible.js +84 -0
- package/dist/extensions/shared/rtk-gain.js +1 -1
- package/dist/extensions/shared/sqlite.js +7 -13
- package/dist/extensions/shared/status.js +1 -2
- package/dist/extensions/shared/usage-ledger.js +102 -20
- package/extensions/caveman/index.ts +6 -2
- package/extensions/caveman/rule-lite.md +77 -0
- package/extensions/caveman/rule-megacave-lite.md +59 -0
- package/extensions/caveman/rule-megacave-ultra.md +59 -0
- package/extensions/caveman/rule.md +1 -1
- package/extensions/combo/index.ts +27 -7
- package/extensions/pstack/index.ts +3 -1
- package/extensions/pstack/playbooks/authoring-a-skill.md +12 -0
- package/extensions/pstack/playbooks/autonomous-run.md +13 -0
- package/extensions/pstack/playbooks/autopilot-full.md +13 -0
- package/extensions/pstack/playbooks/autopilot-stack.md +16 -0
- package/extensions/pstack/playbooks/babysit.md +23 -0
- package/extensions/pstack/playbooks/bug-fix.md +15 -0
- package/extensions/pstack/playbooks/eval.md +25 -0
- package/extensions/pstack/playbooks/feature.md +21 -0
- package/extensions/pstack/playbooks/hillclimb.md +21 -0
- package/extensions/pstack/playbooks/investigation.md +14 -0
- package/extensions/pstack/playbooks/multi-phase-plan.md +155 -0
- package/extensions/pstack/playbooks/opening-a-pr.md +34 -0
- package/extensions/pstack/playbooks/orchestrate.md +111 -0
- package/extensions/pstack/playbooks/pause-safely.md +10 -0
- package/extensions/pstack/playbooks/perf-issue.md +25 -0
- package/extensions/pstack/playbooks/prototype.md +14 -0
- package/extensions/pstack/playbooks/refactoring.md +16 -0
- package/extensions/pstack/playbooks/runtime-forensics.md +11 -0
- package/extensions/pstack/playbooks/session-pickup.md +11 -0
- package/extensions/pstack/playbooks/shipping.md +17 -0
- package/extensions/pstack/playbooks/trace-forensics.md +14 -0
- package/extensions/pstack/playbooks/visual-parity.md +11 -0
- package/extensions/pstack/playbooks/worktree-cleanup.md +12 -0
- package/extensions/pstack/principles/attack-the-premise.md +22 -0
- package/extensions/pstack/principles/boundary-discipline.md +33 -0
- package/extensions/pstack/principles/build-the-lever.md +22 -0
- package/extensions/pstack/principles/encode-lessons-in-structure.md +10 -0
- package/extensions/pstack/principles/exhaust-the-design-space.md +8 -0
- package/extensions/pstack/principles/experience-first.md +18 -0
- package/extensions/pstack/principles/explain-the-number.md +16 -0
- package/extensions/pstack/principles/fix-root-causes.md +23 -0
- package/extensions/pstack/principles/foundational-thinking.md +20 -0
- package/extensions/pstack/principles/guard-the-context-window.md +11 -0
- package/extensions/pstack/principles/laziness-protocol.md +9 -0
- package/extensions/pstack/principles/make-operations-idempotent.md +23 -0
- package/extensions/pstack/principles/migrate-callers-then-delete-legacy-apis.md +21 -0
- package/extensions/pstack/principles/minimize-reader-load.md +17 -0
- package/extensions/pstack/principles/model-the-domain.md +23 -0
- package/extensions/pstack/principles/never-block-on-the-human.md +14 -0
- package/extensions/pstack/principles/outcome-oriented-execution.md +20 -0
- package/extensions/pstack/principles/prove-it-works.md +21 -0
- package/extensions/pstack/principles/redesign-from-first-principles.md +15 -0
- package/extensions/pstack/principles/separate-before-serializing-shared-state.md +15 -0
- package/extensions/pstack/principles/sequence-verifiable-units.md +16 -0
- package/extensions/pstack/principles/subtract-before-you-add.md +17 -0
- package/extensions/pstack/principles/test-behavior-not-implementation.md +20 -0
- package/extensions/pstack/principles/type-system-discipline.md +17 -0
- package/extensions/pstack/references/bugbot-triage.md +142 -0
- package/extensions/pstack/rule.md +88 -12
- package/extensions/pstack/skills/architect/SKILL.md +78 -0
- package/extensions/pstack/skills/architect/references/design-red-flags.md +57 -0
- package/extensions/pstack/skills/architect/references/rationale-template.md +35 -0
- package/extensions/pstack/skills/architect/references/runner-prompt.md +20 -0
- package/extensions/pstack/skills/arena/SKILL.md +47 -0
- package/extensions/pstack/skills/benchmark-checklist/SKILL.md +38 -0
- package/extensions/pstack/skills/blast-radius/SKILL.md +49 -0
- package/extensions/pstack/skills/bro/SKILL.md +6 -0
- package/extensions/pstack/skills/correct/SKILL.md +31 -0
- package/extensions/pstack/skills/figure-it-out/SKILL.md +51 -0
- package/extensions/pstack/skills/how/SKILL.md +35 -0
- package/extensions/pstack/skills/how/references/explainer-prompt.md +55 -0
- package/extensions/pstack/skills/how/references/explorer-prompt.md +35 -0
- package/extensions/pstack/skills/interrogate/SKILL.md +73 -0
- package/extensions/pstack/skills/interrogate/references/code-quality-review.md +47 -0
- package/extensions/pstack/skills/interrogate/references/lead-judgment.md +58 -0
- package/extensions/pstack/skills/interrogate/references/reviewer-prompt.md +62 -0
- package/extensions/pstack/skills/interrogate/references/rubric.md +77 -0
- package/extensions/pstack/skills/no-comments/SKILL.md +23 -0
- package/extensions/pstack/skills/reflect/SKILL.md +66 -0
- package/extensions/pstack/skills/reflect/references/divergent-reviewer.md +38 -0
- package/extensions/pstack/skills/reflect/references/judgment-reviewer.md +37 -0
- package/extensions/pstack/skills/reflect/references/synthesizer.md +56 -0
- package/extensions/pstack/skills/reflect/references/tooling-reviewer.md +48 -0
- package/extensions/pstack/skills/show-me-your-work/SKILL.md +81 -0
- package/extensions/pstack/skills/swarm/SKILL.md +45 -0
- package/extensions/pstack/skills/tdd/SKILL.md +41 -0
- package/extensions/pstack/skills/technical-writing/SKILL.md +105 -0
- package/extensions/pstack/skills/unslop/SKILL.md +61 -0
- package/extensions/pstack/skills/why/SKILL.md +97 -0
- package/extensions/pstack/skills/why/references/epistemics.md +71 -0
- package/extensions/pstack/skills/why/references/investigator-prompt.md +84 -0
- package/extensions/pstack/skills/why/references/source-playbook.md +17 -0
- package/extensions/pstack/skills/why/references/sources/code-archaeology.md +51 -0
- package/extensions/pstack/skills/why/references/sources/databricks.md +70 -0
- package/extensions/pstack/skills/why/references/sources/datadog.md +97 -0
- package/extensions/pstack/skills/why/references/sources/incident-postmortem.md +5 -0
- package/extensions/pstack/skills/why/references/sources/linear.md +48 -0
- package/extensions/pstack/skills/why/references/sources/notion.md +55 -0
- package/extensions/pstack/skills/why/references/sources/sentry.md +66 -0
- package/extensions/pstack/skills/why/references/sources/slack.md +17 -0
- package/extensions/pstack/skills/why/references/synthesizer-prompt.md +129 -0
- package/extensions/rtk/session.ts +17 -9
- package/extensions/shared/rtk-eligible.ts +83 -0
- package/extensions/shared/rtk-gain.ts +1 -1
- package/extensions/shared/sqlite.ts +7 -13
- package/extensions/shared/status.ts +1 -2
- package/extensions/shared/usage-ledger.ts +97 -19
- package/extensions/timing/index.ts +1 -2
- package/package.json +7 -4
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: why
|
|
3
|
+
description: "Use for 'why does X work this way', 'why we picked Y', design rationale, regressions, postmortems, or data-backed thresholds. Discovers available MCPs and queries each evidence category (source control, issue tracker, long-form docs, real-time chat, infrastructure observability, error tracking, product analytics warehouse) in parallel, then returns a cited read on decisions and tradeoffs. Use how for runtime behavior."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Why
|
|
7
|
+
|
|
8
|
+
Investigate the motivation and intent behind code. The companion `how` skill answers what the code does and how it works. `why` answers what forces led to its shape.
|
|
9
|
+
|
|
10
|
+
Each spawn below names a role line in your configuration and a default. Set `model` to that line's value, or to the default if the line is missing. Leave `model` unset when the value is `auto` or `inherit-parent`. If the Task tool rejects a slug, use the default and say so. If it rejects the default, use the closest valid slug of the same family from its error message.
|
|
11
|
+
|
|
12
|
+
Every spawn is an agent-mode subagent (`readonly: false`). **Do not use a read-only or ask mode.** It strips MCP access, which disables the MCP-backed investigators and the synthesizer's citation spot-checks. Investigators still shouldn't write anything.
|
|
13
|
+
|
|
14
|
+
## Operating Posture
|
|
15
|
+
|
|
16
|
+
Operate as a **careful, cautious, and precise investigator**. Be honest about what you know vs what you're inferring. Read `references/epistemics.md` for the full confidence framework and phrasing guide. The synthesizer must follow it.
|
|
17
|
+
|
|
18
|
+
## Step 1. Understand the Target and the Question
|
|
19
|
+
|
|
20
|
+
The **target** is usually a chunk of code, a pattern, a feature, or a named design decision. The **question** is usually a design rationale, a tradeoff, a motivating edge case, an external constraint, dead code, or a broad history sweep.
|
|
21
|
+
|
|
22
|
+
If the target is vague ("why do we do it this way?" with no clear referent), make your best guess from conversation context (open files, recent edits, cursor location, what was just discussed). State your interpretation briefly so the user can redirect if you're off, then proceed.
|
|
23
|
+
|
|
24
|
+
## Step 2. Establish the Code Anchor
|
|
25
|
+
|
|
26
|
+
Before spawning investigators, build the seed context inline: file paths and line ranges, key symbols (functions, classes, constants), the last few commits touching the target, PR numbers from merge commits (pattern `(#1234)` in the subject line), and any linked ticket IDs. Run `git blame -L <start>,<end> <file>` for last-touch commits, `git log --follow -p -- <file>` for full history with patches through renames, `git log --oneline -20 -- <file>` for recent commits with PR numbers visible, and `git log -1 --format=%B <commit>` to extract PR numbers. Then pull the PR bodies and discussion for any substantive commit: `gh pr view <number> --json title,body,author,createdAt,mergedAt,labels,closingIssuesReferences,comments,reviews`. This anchor goes to every investigator and to the synthesizer.
|
|
27
|
+
|
|
28
|
+
## Step 3. Spawn Parallel Investigators
|
|
29
|
+
|
|
30
|
+
**Default to the full parallel investigation.** The goal is a complete coverage map, not a minimal one. Document the null, don't skip the search.
|
|
31
|
+
|
|
32
|
+
### Discovery
|
|
33
|
+
|
|
34
|
+
Before spawning investigators, list the available MCPs from the host environment. Use the available-tools map when present.
|
|
35
|
+
|
|
36
|
+
Map each available MCP to one evidence category:
|
|
37
|
+
|
|
38
|
+
1. Source control history
|
|
39
|
+
2. Issue / ticket tracker
|
|
40
|
+
3. Long-form documents
|
|
41
|
+
4. Real-time team chat
|
|
42
|
+
5. Infrastructure observability
|
|
43
|
+
6. Error / exception tracking
|
|
44
|
+
7. Product analytics warehouse
|
|
45
|
+
|
|
46
|
+
Source control is always available through git and `gh`. For the other six, classify using the MCP name, server instructions, tool names, and resource descriptors. If an MCP could fit more than one category, choose the one matching its primary evidence. Record ambiguous cases in the coverage map.
|
|
47
|
+
|
|
48
|
+
Spawn one investigator per category that has a matching MCP, all in a single message so they run concurrently, each owning exactly one tool or MCP. Don't ask one agent to cover multiple MCPs. `model`: the `why investigators` line, default a fast model.
|
|
49
|
+
|
|
50
|
+
Each investigator's prompt is `references/investigator-prompt.md` filled in, plus:
|
|
51
|
+
- the category playbook `references/sources/<source>.md` for the selected MCP, adapted from the examples in `references/source-playbook.md`
|
|
52
|
+
- `references/sources/incident-postmortem.md` **if the target code looks defensive** (null checks, retry logic, timeout handling, rate limiting, feature flags, egress guards, OOM handlers)
|
|
53
|
+
- the code anchor and the user's original question
|
|
54
|
+
|
|
55
|
+
### Investigator roster, one per available evidence category
|
|
56
|
+
|
|
57
|
+
Each category below is uniquely positioned to surface one shape of "why", shown after "Best at". Use it to know what to expect back, to name a gap when a category returns empty, and, only in the rare provably-irrelevant case, to justify a skip.
|
|
58
|
+
|
|
59
|
+
1. **Source control** (git history, `gh` for PRs, code comments, tests). Always spawn, the only guaranteed source. Best at *implementation-time rationale captured during review*.
|
|
60
|
+
2. **Issue / ticket tracker** (e.g. Linear, Jira, GitHub Issues, Plane, Shortcut MCP). Best at *the product or business forcing function*. Strongest when the why is external to engineering.
|
|
61
|
+
3. **Long-form documents** (e.g. Notion, Confluence, Google Docs, Coda MCP). Best at *long-form design rationale*, written out before it becomes code.
|
|
62
|
+
4. **Real-time team chat** (e.g. Slack, Discord, Microsoft Teams, Mattermost MCP). Best at *real-time deliberation that never reached a doc*. Especially important when the source control, ticket, and doc paper trail is thin.
|
|
63
|
+
5. **Infrastructure observability** (e.g. Datadog, New Relic, Honeycomb, Grafana, Splunk MCP). Best at *infrastructure and runtime reality that motivated the code*. Strongest when the target reacts to an infra signal (timeouts, retries, rate limits, circuit breakers).
|
|
64
|
+
6. **Error / exception tracking** (e.g. Sentry, Rollbar, Bugsnag, Airbrake MCP). Best at *the specific exceptions and error trajectories that motivated defensive or corrective code*. Strongest for catch blocks, null guards, type checks, retries, and other defenses.
|
|
65
|
+
7. **Product analytics warehouse** (e.g. Databricks, Snowflake, BigQuery, ClickHouse, dbt, Redshift MCP). Best at *product and data reality that shaped the code*. Strongest for flag-gated code, experiment-driven ships, data migrations, and "where did this number come from" questions.
|
|
66
|
+
|
|
67
|
+
### When to skip an investigator
|
|
68
|
+
|
|
69
|
+
Only with an **explicit, written justification** that goes in the final Sources Consulted. Two valid reasons:
|
|
70
|
+
|
|
71
|
+
- **No MCP is available for that category** in this environment. Flag it as a gap, not a choice: "Real-time team chat skipped. No matching MCP available, so the conversational record was not searchable."
|
|
72
|
+
- **The source is provably irrelevant**, not just "probably irrelevant." A high bar: "Error / exception tracking skipped. Target is a build-time script with no runtime code path."
|
|
73
|
+
|
|
74
|
+
If your scope assessment suggests a single-commit trivial target where the PR description already contains the complete answer, you may answer inline **only after** confirming all seven available category searches would be redundant. Say so explicitly. This should be rare.
|
|
75
|
+
|
|
76
|
+
## Step 4. Synthesize
|
|
77
|
+
|
|
78
|
+
Spawn one synthesizer. `model`: the `why synthesizer` line, default the strongest model. It gets:
|
|
79
|
+
1. The investigator findings, including any null results and any categories skipped with justification
|
|
80
|
+
2. The code anchor
|
|
81
|
+
3. The user's original question
|
|
82
|
+
4. The epistemics framework from `references/epistemics.md`
|
|
83
|
+
5. The synthesizer prompt template from `references/synthesizer-prompt.md`
|
|
84
|
+
|
|
85
|
+
## Step 5. Present
|
|
86
|
+
|
|
87
|
+
Present the synthesizer's output to the user. You may lightly edit for clarity or add context from the conversation, but **do not rewrite the confidence language**.
|
|
88
|
+
|
|
89
|
+
## Output Format
|
|
90
|
+
|
|
91
|
+
The structure is the one in `references/synthesizer-prompt.md`: The Question, The Code in Question, What We Found, What We Can Reasonably Infer, Competing Hypotheses, What We Don't Know, Sources Consulted, Confidence Summary. Adapt as needed, but keep the confidence separation intact, and keep Sources Consulted as one line per investigator, including the ones that returned nothing or were skipped, with the reason.
|
|
92
|
+
|
|
93
|
+
After Sources Consulted, if the user's `why` question is a precursor to changing this code, convert the lineage findings into a Preserve / Change / Avoid / Risk constraint set for planning the change.
|
|
94
|
+
|
|
95
|
+
## Common Failure Modes to Avoid
|
|
96
|
+
|
|
97
|
+
- **Recency bias**. Assuming the most recent commit is authoritative. The current shape is often the accretion of many earlier decisions. Trace back.
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
# Epistemics
|
|
2
|
+
|
|
3
|
+
How to reason about confidence when evidence is historical, fragmentary, and sometimes contradictory, and how to tell the user without flattening it into false certainty. Code shows what it does, not *why it exists*. The why lives in commits, PRs, tickets, docs, and conversations, all incomplete, biased, and sometimes missing. Pretending otherwise produces confident-sounding guesses that mislead the user.
|
|
4
|
+
|
|
5
|
+
## Confidence Tiers
|
|
6
|
+
|
|
7
|
+
Every claim in the output must sit in one tier. The tier sets its section and its phrasing.
|
|
8
|
+
|
|
9
|
+
### 1. Direct
|
|
10
|
+
|
|
11
|
+
An explicit, textual citation answers the question: something an author actually *wrote* that says why, not "the code does X so the author must have wanted X." For example, a PR description "this fixes the bug where users with >1000 items couldn't paginate", a ticket "we're adding this because customer Acme requested it in their security review", a code comment "// clamp to 100 because the upstream API rejects larger values", a design doc "we chose option A over option B because we need persistence across restarts", or a chat message from the author "switching to this approach since the old one was flaky in tests".
|
|
12
|
+
|
|
13
|
+
Phrasing: confident, present tense, cited. "This exists because X."
|
|
14
|
+
|
|
15
|
+
### 2. Supported
|
|
16
|
+
|
|
17
|
+
Multiple pieces of indirect evidence converge on one conclusion. No single source states it explicitly, but the pattern across sources makes it likely. For example, the PR title says "improve performance", the ticket is labeled "perf", and the surrounding commits all touch the same hot path. Or several tests added with the change all exercise very large inputs. Or the author's other PRs from the same week all name the same incident.
|
|
18
|
+
|
|
19
|
+
Phrasing: confident but clearly derived, citing each item. "The evidence points strongly to X: [the specific pieces]."
|
|
20
|
+
|
|
21
|
+
### 3. Inferred
|
|
22
|
+
|
|
23
|
+
A reasonable reading of the context that nothing explicitly supports. It is *your interpretation*, not a fact from the record. For example, the PR doesn't say why, but the error was happening in production (per the incident channel timing) and the fix was rushed (merged the same day), so it was likely a hotfix. Or the function name suggests retry logic, and its retry count of 3 matches the team's 3-retry convention elsewhere in the codebase.
|
|
24
|
+
|
|
25
|
+
Phrasing: hedged, with the chain explicit. "Given A and B, C seems likely because D."
|
|
26
|
+
|
|
27
|
+
### 4. Speculative
|
|
28
|
+
|
|
29
|
+
A plausible hypothesis on thin evidence, where other explanations fit equally well. Worth presenting, since the user may know which is right, but mark it as a guess. For example, "This might be a workaround for a browser bug that's since been fixed, but we found no contemporary evidence of that", or "It's possible this threshold was chosen to match an SLA commitment, but no SLA doc references it."
|
|
30
|
+
|
|
31
|
+
Phrasing: "One possibility is X, but we have no direct evidence." Usually lives in Competing Hypotheses, alongside other possibilities.
|
|
32
|
+
|
|
33
|
+
### 5. Unknown
|
|
34
|
+
|
|
35
|
+
You looked and couldn't find out. A valid, important outcome. Document it.
|
|
36
|
+
|
|
37
|
+
Phrasing: "We searched X, Y, and Z and found no evidence of why." Be specific about *what* you searched. "We couldn't find out" is less useful than "We searched the ticket tracker with keywords A and B, scanned the 6 PRs that touched this file since 2023, and grep'd the repo for string literals matching the threshold. None surfaced a rationale."
|
|
38
|
+
|
|
39
|
+
## Phrasing Guide
|
|
40
|
+
|
|
41
|
+
**Confidence words** imply Direct or Supported evidence and need a citation immediately adjacent. Never use them for inferences: "because", "the reason is", "was designed to" (claims author intent), "fixes" / "addresses" / "solves" (claims the change achieved its goal), "the team decided" (claims a group decision happened).
|
|
42
|
+
|
|
43
|
+
**Hedges** signal interpretation, not report. Use them liberally in What We Can Reasonably Infer: "appears to", "seems to", "likely", "suggests", "is consistent with", "one reading is", "plausibly", "may have been", "the evidence points toward".
|
|
44
|
+
|
|
45
|
+
**Words to avoid:**
|
|
46
|
+
|
|
47
|
+
- "obviously". If it were obvious, the user wouldn't be asking
|
|
48
|
+
- "clearly". Almost always precedes a claim that isn't clear
|
|
49
|
+
- "of course". Same
|
|
50
|
+
- "just" (as in "it's just X for performance"). Dismissive and usually hides uncertainty
|
|
51
|
+
- "I think" / "I believe". You're synthesizing evidence, not giving a personal opinion. Use "the evidence suggests" instead.
|
|
52
|
+
|
|
53
|
+
## Avoid Rationalization
|
|
54
|
+
|
|
55
|
+
Code that "makes sense" today may have been written for reasons that no longer apply, or that were wrong at the time. Don't retrofit a clean rationale onto messy history. Don't assume the author did the "right" thing and work backward to justify it. Don't assume a consistent pattern was intentional when it might be copy-paste. Don't turn an absence of evidence into evidence of absence ("no one mentioned security concerns, so it must not have been a concern").
|
|
56
|
+
|
|
57
|
+
## The Sycophancy Trap
|
|
58
|
+
|
|
59
|
+
Users often embed a hypothesis: "Why do we do it this way, I assume it's for performance?" Don't simply confirm it. The guess is a prompt for investigation, not a conclusion to validate. Treat it as one candidate among others and check the evidence independently. If the evidence supports it, say so with citations. If not, say so, and present what the evidence *does* support.
|
|
60
|
+
|
|
61
|
+
## When Evidence Contradicts
|
|
62
|
+
|
|
63
|
+
Surface both sources in the output, with citations. Don't pick the one that fits a tidier narrative. For example, the ticket says "we need this for customer X's compliance requirement" and the PR says "cleaning up tech debt in this area". Both may be true (the ticket motivated the work, the PR gave the author's framing), or one may be wrong. Let the user make the call.
|
|
64
|
+
|
|
65
|
+
## When Evidence Is Missing
|
|
66
|
+
|
|
67
|
+
An honest "we don't know" is one of the most valuable outputs. The user learns the answer isn't in the obvious places, that they'll need to ask a human (the original author, the product owner, the team lead), or that they can decide the question isn't worth pursuing further. Failing to mark a gap, and instead filling it with a confident guess, actively harms the user, because they'll act on the guess. Name each gap concretely: the question, the sources searched, what you searched for in each, and what you found (nothing, or only tangential material).
|
|
68
|
+
|
|
69
|
+
## Before Finalizing
|
|
70
|
+
|
|
71
|
+
Before the synthesizer delivers the output, it checks every claim in "What We Found" and "What We Can Reasonably Infer". Each claim has a citation or moves to Inferred or Hypotheses. Its phrasing matches its tier. It doesn't treat code as evidence for its own intent (if it does, remove or reclassify it). The output has a "What We Don't Know" section. If no gaps are mentioned, that's suspicious. Either the evidence was unusually complete or something is being swept under the rug.
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
# Investigator Prompt Template
|
|
2
|
+
|
|
3
|
+
Fill in the placeholders. Append the one category playbook `sources/<source>.md` for this investigator's evidence category (index: `source-playbook.md`). If the target code looks defensive (null checks, retry logic, timeout handling, rate limiting, feature flags, egress guards, OOM handlers), also append `sources/incident-postmortem.md` so the investigator runs incident-flavored queries inside its own source.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
You are investigating the historical context and motivation behind a piece of code. Other investigators search other sources in parallel, and a separate synthesizer combines all findings into the final answer. Go deep on your assigned source only. Gather evidence accurately rather than writing prose.
|
|
8
|
+
|
|
9
|
+
Work like a **careful, cautious, and precise investigator**. Surface evidence and describe it accurately, including the parts that don't fit a tidy story. Boring and exact beats plausible. One verbatim quote with a precise citation is worth more than a paragraph of summary.
|
|
10
|
+
|
|
11
|
+
## The Question
|
|
12
|
+
|
|
13
|
+
> {QUESTION}
|
|
14
|
+
|
|
15
|
+
## The Code Anchor
|
|
16
|
+
|
|
17
|
+
**Target files:** {FILES_WITH_LINE_RANGES}
|
|
18
|
+
|
|
19
|
+
**Key symbols:** {SYMBOLS}
|
|
20
|
+
|
|
21
|
+
**Initial commits touching this code (most recent first):**
|
|
22
|
+
{COMMIT_LIST}
|
|
23
|
+
|
|
24
|
+
**PR numbers extracted from commit messages:** {PR_NUMBERS}
|
|
25
|
+
|
|
26
|
+
**Ticket IDs mentioned in commits or PR bodies (if any):** {TICKET_IDS}
|
|
27
|
+
|
|
28
|
+
## Your Assigned Source
|
|
29
|
+
|
|
30
|
+
{SOURCE_NAME}
|
|
31
|
+
|
|
32
|
+
{SOURCE_PLAYBOOK_SECTION}
|
|
33
|
+
|
|
34
|
+
## Investigation Loop
|
|
35
|
+
|
|
36
|
+
1. **Cast a wide net first** so you don't miss related context. Only then narrow in on specific items.
|
|
37
|
+
2. **Read the whole thing.** Read each PR, ticket, doc, or thread fully, not just the title or summary. The key evidence is often in a comment, a subtask, or a follow-up.
|
|
38
|
+
3. **Follow links within your source only.** Pull the PR or commit a PR references, the parent or sibling of a ticket, the doc a doc links. Do NOT chase a cross-source reference. Record it under Additional Leads for that source's investigator. The one-investigator-per-category design depends on this. Chasing it duplicates work and confuses scope.
|
|
39
|
+
4. **Quote verbatim**, with the exact location (PR number, ticket ID, URL, commit hash, file:line), so the reader can confirm the claim in seconds.
|
|
40
|
+
5. **Record what you searched, not just what you found.** Write queries verbatim. An empty search is a finding.
|
|
41
|
+
6. **Resist the story.** If two items in your source disagree, record both. Don't suppress the inconvenient one. If three items line up and a fourth contradicts them, the contradiction is the most interesting finding.
|
|
42
|
+
|
|
43
|
+
Before reporting a finding as strong, ask whether you would expect to find it if your current reading were wrong, and how the evidence would differ. **Never invent.** If you're tempted to round a partial finding up into a confident statement, stop and label it partial. The synthesizer counts on your output being accurate.
|
|
44
|
+
|
|
45
|
+
## Epistemic Discipline
|
|
46
|
+
|
|
47
|
+
- **Mechanics are not motivation.** A commit changing `limit = 50` to `limit = 100` shows the change, not necessarily why. Look for the reason in the commit message, PR description, linked ticket, or review comments.
|
|
48
|
+
- **No intent from code behavior or style.** You may read code to learn what the target *is*. "The author chose a functional approach" is an observation about code, not evidence of intent. Claim intent only where the author stated it.
|
|
49
|
+
- **Preserve uncertainty.** Say when evidence is ambiguous, or when one reading is more plausible but not certain. Don't collapse ambiguity to look decisive.
|
|
50
|
+
- **No silent substitutions.** If the question is about feature X and you only find evidence about feature Y, don't present Y's evidence as if it answers X.
|
|
51
|
+
- **Gather, don't conclude.** Collect the raw material honestly and completely. Don't answer the question, form a final opinion on "the why", or pick sides in contradictions. Don't speculate beyond what the evidence supports. A hunch with no evidence isn't evidence. The synthesizer does the reasoning.
|
|
52
|
+
|
|
53
|
+
## Output Format
|
|
54
|
+
|
|
55
|
+
Return your findings in this structure. The synthesizer reads it directly.
|
|
56
|
+
|
|
57
|
+
### Source
|
|
58
|
+
Which source you investigated (source control, issue / ticket tracker, long-form documents, real-time team chat, infrastructure observability, error / exception tracking, product analytics warehouse, code comments, etc.).
|
|
59
|
+
|
|
60
|
+
### What I Searched
|
|
61
|
+
The queries you ran, items you opened, and places you looked. Be specific. This shows how thorough the search was and what is still unsearched.
|
|
62
|
+
|
|
63
|
+
### Direct Evidence Found
|
|
64
|
+
For each item that explicitly addresses the question:
|
|
65
|
+
- **What it says**: verbatim quote or accurate paraphrase
|
|
66
|
+
- **Where it's from**: PR #123, ticket ID, doc URL, chat permalink, commit hash, or file:line
|
|
67
|
+
- **Author and date** (if available)
|
|
68
|
+
- **Relevance**: one sentence on how it bears on the question
|
|
69
|
+
|
|
70
|
+
### Indirect / Circumstantial Evidence
|
|
71
|
+
For each item that bears on the question without answering it:
|
|
72
|
+
- **What it is**: brief description
|
|
73
|
+
- **Where it's from**: location
|
|
74
|
+
- **What it suggests**: what a careful reader might infer, and the inference chain
|
|
75
|
+
- **Alternative readings**: if the same evidence could support a different interpretation, note it
|
|
76
|
+
|
|
77
|
+
### Contradictions
|
|
78
|
+
Items that disagree with each other, with both citations.
|
|
79
|
+
|
|
80
|
+
### Gaps
|
|
81
|
+
What you searched for and didn't find, specifically: "Searched the issue tracker for [query] across [time range]. No matching issues."
|
|
82
|
+
|
|
83
|
+
### Additional Leads
|
|
84
|
+
Anything that suggests further investigation in a different source, for its investigator or a follow-up pass. For example, a chat thread that a PR mentions.
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# Source playbooks
|
|
2
|
+
|
|
3
|
+
The why skill spawns one investigator per available evidence category, each reading a single source-specific playbook below. The playbooks are concrete examples for common MCPs. Adapt them for a different MCP in the same category.
|
|
4
|
+
|
|
5
|
+
| Category | Playbook | Example MCP it documents |
|
|
6
|
+
|---|---|---|
|
|
7
|
+
| Source control history | [`code-archaeology.md`](./sources/code-archaeology.md) | git, `gh` |
|
|
8
|
+
| Issue / ticket tracker | [`linear.md`](./sources/linear.md) | Linear (adapt for Jira, GitHub Issues, Plane, Shortcut) |
|
|
9
|
+
| Long-form documents | [`notion.md`](./sources/notion.md) | Notion (adapt for Confluence, Google Docs, Coda) |
|
|
10
|
+
| Real-time team chat | [`slack.md`](./sources/slack.md) | Slack (adapt for Discord, Microsoft Teams, Mattermost) |
|
|
11
|
+
| Infrastructure observability | [`datadog.md`](./sources/datadog.md) | Datadog (adapt for New Relic, Honeycomb, Grafana, Splunk) |
|
|
12
|
+
| Error / exception tracking | [`sentry.md`](./sources/sentry.md) | Sentry (adapt for Rollbar, Bugsnag, Airbrake) |
|
|
13
|
+
| Product analytics warehouse | [`databricks.md`](./sources/databricks.md) | Databricks SQL (adapt for Snowflake, BigQuery, ClickHouse, dbt) |
|
|
14
|
+
|
|
15
|
+
Cross-cutting:
|
|
16
|
+
|
|
17
|
+
- [`incident-postmortem.md`](./sources/incident-postmortem.md). Add this if the target code looks defensive (null checks, retry, timeout, rate limit, feature flag, egress guard, OOM handler).
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
# Code Archaeology (git + in-repo)
|
|
2
|
+
|
|
3
|
+
## What this source contains
|
|
4
|
+
|
|
5
|
+
- Commit history (messages, dates, authors, diffs)
|
|
6
|
+
- PR descriptions, review comments, and discussion threads (via `gh`)
|
|
7
|
+
- Inline code comments, TODOs, FIXMEs, deprecation notes
|
|
8
|
+
- ADRs (architectural decision records) if the repo keeps them
|
|
9
|
+
- Tests, whose names and assertions often encode the edge cases that motivated a change
|
|
10
|
+
- Related files modified in the same commits (co-change signal)
|
|
11
|
+
- CHANGELOG entries and release notes in the repo
|
|
12
|
+
- Issue/ticket IDs in commit messages and PR bodies
|
|
13
|
+
|
|
14
|
+
The most trustworthy source, tied directly to the code, and the most complete. Everything that went through the repo should be here.
|
|
15
|
+
|
|
16
|
+
## How to search it
|
|
17
|
+
|
|
18
|
+
Expand the seed commit list:
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
# History through renames
|
|
22
|
+
git log --follow --oneline -- <file>
|
|
23
|
+
|
|
24
|
+
# Pickaxe: commits that added or removed this exact text
|
|
25
|
+
git log -S '<exact_string_from_code>' -- <file>
|
|
26
|
+
|
|
27
|
+
# Or for patterns:
|
|
28
|
+
git log -G '<regex>' -- <file>
|
|
29
|
+
|
|
30
|
+
# Who wrote each line and when
|
|
31
|
+
git blame -L <start>,<end> <file>
|
|
32
|
+
|
|
33
|
+
# One commit's full diff
|
|
34
|
+
git show <hash>
|
|
35
|
+
|
|
36
|
+
# Commits between two points affecting this file
|
|
37
|
+
git log <old>..<new> -p -- <file>
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
Look for out-of-band docs:
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
# ADRs often live in docs/adr/ or similar
|
|
44
|
+
rg -l -i 'architecture.decision' --glob '*.md'
|
|
45
|
+
|
|
46
|
+
# TODOs and FIXMEs near the target
|
|
47
|
+
rg -n -C2 '(TODO|FIXME|HACK|XXX|NOTE)' <target_file>
|
|
48
|
+
|
|
49
|
+
# Related tests
|
|
50
|
+
rg -l '<symbol>' --glob '*test*'
|
|
51
|
+
```
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
# Databricks Analytics & System Tables
|
|
2
|
+
|
|
3
|
+
## What this source contains
|
|
4
|
+
|
|
5
|
+
Databricks is the product-analytics, data-pipeline, and warehouse-telemetry layer. It complements Datadog. Datadog is the *infra/runtime* view, Databricks is the *product/data* view (what users did, which experiments ran, how feature usage evolved, where a threshold constant came from).
|
|
6
|
+
|
|
7
|
+
- **Product analytics events.** `your_warehouse.events.analytics_track_event` (raw) and typed, deduplicated per-event dbt models in `<your_analytics_db>.<schema>.<table>`. User behavior: feature invocations, clicks, accepts/rejects, submissions, client-reported errors.
|
|
8
|
+
- **Usage & billing events.** `your_warehouse.events.usage_event` / `<your_analytics_db>.<schema>.stg_usage_events`, `your_warehouse.events.raw_model_event` / `<your_analytics_db>.<schema>.stg_raw_model_events`. For cost- or volume-driven decisions.
|
|
9
|
+
- **Experiment / feature-flag data.** Exposure and outcome tables. **Schema is company-specific.** Probe with `SHOW TABLES` before assuming names.
|
|
10
|
+
- **System tables.** `system.query.history`, `system.compute.warehouses`, `system.billing.*`, `system.access.audit`. Answer "was this query expensive?", "how often did anyone run this?", "when did warehouse load spike?"
|
|
11
|
+
- **dbt lineage.** Models in `<your_analytics_db>.<schema>` reveal what pipelines depend on a table/field. Upstream changes frequently motivate consumer-code changes.
|
|
12
|
+
- **Databricks notebooks.** Exploratory analyses engineers wrote before code changes. **Not queryable via the SQL MCP.** If you suspect the rationale lives in a notebook, name it as a gap.
|
|
13
|
+
|
|
14
|
+
## How to search it
|
|
15
|
+
|
|
16
|
+
Use the Databricks SQL MCP. Primary tool: `execute_sql_read_only`. If it returns a `statement_id`, poll with `poll_sql_result` rather than re-running.
|
|
17
|
+
|
|
18
|
+
**Orient before querying.** Schemas are company-specific. Probe before trusting a table name:
|
|
19
|
+
|
|
20
|
+
```sql
|
|
21
|
+
SHOW TABLES IN <your_analytics_db>.<schema> LIKE '*<keyword>*';
|
|
22
|
+
DESCRIBE TABLE <your_analytics_db>.<schema>.stg_<event>;
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
**Time-bound every query.** These tables are huge and unconstrained scans time out. Filter on `_timestamp` (events) or `start_time` (`system.query.history`) with a window bracketing the ship date, typically ~30 days before and after, wider only for strong reason.
|
|
26
|
+
|
|
27
|
+
**Prefer typed dbt models over the raw table.** `<your_analytics_db>.<schema>.<table>` is deduplicated, typed, and liquid-clustered. `your_warehouse.events.analytics_track_event` has duplicates and untyped `properties_json`. Model-name pattern: `stg_<source>_<event_name_with_underscores>`, where `<source>` is `app`, `backend`, `website`, or `cli`. Confirm the exact model name with `SHOW TABLES` when the pattern alone doesn't resolve it. Drop to the raw table only when there's no dbt model yet, or you need events from inside the dbt refresh lag.
|
|
28
|
+
|
|
29
|
+
**Column conventions on the typed dbt models** (knowing these avoids a `DESCRIBE` round-trip):
|
|
30
|
+
|
|
31
|
+
- `_timestamp`, `_id`, `_auth_id`, `_request_id`, `event_name`. Standard on every model
|
|
32
|
+
- `properties_<name>`. Typed, underscore-cased event properties (`properties_entrypoint`, `properties_size_bytes`, …)
|
|
33
|
+
- `context_team_id`, `context_client_version`, `context_country`, `context_client_os`. Pre-extracted client context
|
|
34
|
+
|
|
35
|
+
### Investigation patterns that tend to pay off
|
|
36
|
+
|
|
37
|
+
Pick the table + column combination that matches the target:
|
|
38
|
+
|
|
39
|
+
1. **Event usage trajectory.** Daily counts on the relevant `stg_*` model across a ±30d window around the PR merge. A step function from zero to steady volume within a day or two of the merge is strong circumstantial evidence the PR launched the feature. A decay to zero suggests a deprecation or deletion.
|
|
40
|
+
2. **Guard-rail / defensive-check origin.** Distribution (median / p99 / max) of the relevant `properties_<name>` column in the 14 days *before* the PR. A p99 that matches the target's threshold constant suggests the number was chosen from data.
|
|
41
|
+
3. **Experiment / feature-flag lookup.** `SHOW TABLES ... LIKE '*experiment*'` to find the exposure table, then pull exposure counts by variant for the relevant flag key near the PR date.
|
|
42
|
+
4. **Query-history evidence for migrations, backfills, or perf rewrites.** `system.query.history` filtered by `statement_text ILIKE '%<table_or_symbol>%'` with a tight `start_time` window surfaces the expensive queries that likely motivated the change (sort by `total_duration_ms` or aggregate `SUM(read_bytes)`, `COUNT(*)`).
|
|
43
|
+
5. **dbt lineage.** If the target reads from or writes into a `<your_analytics_db>.<schema>` model, the model's own git history (in this repo) often carries the rationale. Hand that lead back to the git investigator rather than chasing it yourself.
|
|
44
|
+
|
|
45
|
+
## What good evidence looks like here
|
|
46
|
+
|
|
47
|
+
Beyond the pattern shapes above:
|
|
48
|
+
|
|
49
|
+
- An error-classifying event's count drops to near zero in the days after a defensive-code PR. Suggests the PR resolved that error class
|
|
50
|
+
- An exposure table row names the target's feature-flag key with a "shipped" / "concluded" decision around the PR ship date
|
|
51
|
+
|
|
52
|
+
## Common pitfalls
|
|
53
|
+
|
|
54
|
+
- **Instrumented ≠ caused.** An event's existence means someone cared enough to log it, not that the target code exists *because* of it. Pair with a PR/commit citation from the git investigator before claiming causation.
|
|
55
|
+
- **Silent instrumentation changes.** A step function in event volume may mean a new event started being logged, not that user behavior changed. Check for instrumentation PRs in the same window before reading the ramp as a feature-launch signal.
|
|
56
|
+
- **Schema drift.** Event properties evolve. A column on the typed dbt model today may not have existed when the target was written. Older data may carry the property only inside raw `properties_json`.
|
|
57
|
+
- **dbt refresh lag.** `<your_analytics_db>.<schema>.*` is rebuilt on a schedule (often hourly/daily). For events from the last few hours, fall back to `your_warehouse.events.*` and deduplicate by `_id`.
|
|
58
|
+
- **Company-specific tables.** Experiment, feature-flag, billing, and usage tables vary. Reporting a result from a table whose existence you never confirmed is a classic failure mode. Probe with `SHOW TABLES` / `DESCRIBE TABLE` first.
|
|
59
|
+
- **Retention cliff.** If the relevant window predates the table's retention or the dbt model's creation date, that's a *gap*, not a null result. Name it explicitly so the synthesizer doesn't read "no results" as "no activity."
|
|
60
|
+
- **Notebooks aren't queryable.** The SQL MCP can't see Databricks notebooks. If you suspect the rationale lives in one, return a gap.
|
|
61
|
+
|
|
62
|
+
## What to return
|
|
63
|
+
|
|
64
|
+
For each relevant finding:
|
|
65
|
+
- Type (product event / experiment exposure / usage or billing event / system-table row / dbt model)
|
|
66
|
+
- Fully-qualified table name and the exact query you ran
|
|
67
|
+
- Time window queried
|
|
68
|
+
- Compact numeric summary (counts, percentiles, first/last-seen timestamps). **Don't dump raw rows.**
|
|
69
|
+
- Temporal correlation with the target's ship date (e.g., "first row 2024-08-15, PR #49074 merged 2024-08-14")
|
|
70
|
+
- Relevance + strength: direct / circumstantial / weak
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
# Datadog Telemetry
|
|
2
|
+
|
|
3
|
+
## What this source contains
|
|
4
|
+
|
|
5
|
+
Datadog holds the runtime record, what actually happened in production, as opposed to what was planned or discussed.
|
|
6
|
+
|
|
7
|
+
- **Metrics.** Counters, gauges, histograms instrumented by the team. A metric's *presence* is itself evidence that someone thought the number worth watching.
|
|
8
|
+
- **Monitors & alerts.** Conditions the team decided warranted waking someone up. A monitor firing on `rate_limit_hit > 10/min` is direct evidence the team worried about that threshold.
|
|
9
|
+
- **Dashboards.** Curated views of what the team considers important for a subsystem.
|
|
10
|
+
- **APM traces & spans.** Request-level runtime data, for "why is this slow" / "why is there a timeout here" questions.
|
|
11
|
+
- **Logs.** High-volume event records, often holding the error conditions that motivated defensive code.
|
|
12
|
+
- **Incidents.** Formal incident records with timelines and linked postmortems.
|
|
13
|
+
- **Notebooks.** The team's exploratory investigations, often with hypotheses and analyses.
|
|
14
|
+
|
|
15
|
+
## How to search it
|
|
16
|
+
|
|
17
|
+
Use the Datadog MCP. Start broad, then narrow.
|
|
18
|
+
|
|
19
|
+
1. **Identify the owning service(s).**
|
|
20
|
+
|
|
21
|
+
```
|
|
22
|
+
search_datadog_services (filter by name or team)
|
|
23
|
+
search_datadog_service_dependencies (see upstream/downstream)
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
2. **Dashboards and monitors first.**
|
|
27
|
+
|
|
28
|
+
```
|
|
29
|
+
search_datadog_dashboards (query: feature name, service name, symbol)
|
|
30
|
+
search_datadog_monitors (same queries)
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
When a dashboard or monitor covers the target, note its queries and watched thresholds. The threshold is frequently the answer to "why is this clamped at N?"
|
|
34
|
+
|
|
35
|
+
3. **Metrics around the target.**
|
|
36
|
+
|
|
37
|
+
```
|
|
38
|
+
search_datadog_metrics (by name pattern, e.g., the feature or symbol)
|
|
39
|
+
get_datadog_metric_context (metadata: description, units, tags)
|
|
40
|
+
get_datadog_metric (timeseries; "was there a spike around the PR date?")
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
Correlating a metric's trajectory with the target's add/change date is strong supporting evidence: "the `payment_timeout` metric spiked 2023-11-03, and the retry logic merged 2023-11-06."
|
|
44
|
+
|
|
45
|
+
4. **Logs. Narrow, don't dump.**
|
|
46
|
+
|
|
47
|
+
```
|
|
48
|
+
search_datadog_logs (raw log patterns near the target, set use_log_patterns=true)
|
|
49
|
+
analyze_datadog_logs (SQL-style aggregations, only when you need counts)
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
Search with symbols, error strings, or feature names. **Strongly prefer time-bounded queries** (e.g., 30 days before/after the change).
|
|
53
|
+
|
|
54
|
+
5. **APM spans and traces.**
|
|
55
|
+
|
|
56
|
+
```
|
|
57
|
+
aggregate_spans (stats: "how often does this endpoint fail?")
|
|
58
|
+
search_datadog_spans (inspect individual spans)
|
|
59
|
+
get_datadog_trace (a specific trace ID)
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
Useful for timeouts, retries, slow paths, and cross-service behavior.
|
|
63
|
+
|
|
64
|
+
6. **Incidents.**
|
|
65
|
+
|
|
66
|
+
```
|
|
67
|
+
search_datadog_incidents (by title, team, date range)
|
|
68
|
+
get_datadog_incident (full detail for a specific incident)
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
If the target looks defensive, search for incidents around the time it was added. An incident whose timeline includes "added defensive check for X" is near-direct evidence.
|
|
72
|
+
|
|
73
|
+
## What good evidence looks like here
|
|
74
|
+
|
|
75
|
+
- A monitor whose query and threshold match the constraint the code enforces (code clamps to 100, monitor alerts when requests exceed 100/min)
|
|
76
|
+
- A dashboard created by the target's author, with widgets that correspond to what the code measures or guards against
|
|
77
|
+
- A metric showing a production spike immediately before the code was merged, and stable values after
|
|
78
|
+
- An incident record referencing the target code, the same symbols, or the same error strings
|
|
79
|
+
- Logs showing a specific error pattern the defensive code would prevent, timestamped in the window before the change
|
|
80
|
+
|
|
81
|
+
## Common pitfalls
|
|
82
|
+
|
|
83
|
+
- **Correlation is not causation.** A spike before a PR and stabilization after is suggestive, not definitive, since other changes may have landed in the same window. Check neighboring PRs.
|
|
84
|
+
- **Overfitting to the chart you found.** A chart reflects its maker's framing. A chart named "retry success rate" is evidence the team cared about retry success, not that it's why a specific line of code exists.
|
|
85
|
+
- **Vanished telemetry.** Metrics can be renamed, deleted, or have short retention. If you can't find data from the relevant window, that's a gap, not a null result.
|
|
86
|
+
- **Noise at scale.** Narrow log searches by service, tag, and time window aggressively. Use `analyze_datadog_logs` to aggregate rather than dumping raw logs.
|
|
87
|
+
- **Instrumented != caused.** A metric shows someone cared enough to measure something, not that the code was added *because* of it. Cross-reference with commit/PR dates.
|
|
88
|
+
|
|
89
|
+
## What to return
|
|
90
|
+
|
|
91
|
+
For each relevant item:
|
|
92
|
+
- Type (dashboard / monitor / metric / log pattern / trace / incident / notebook)
|
|
93
|
+
- Title or name
|
|
94
|
+
- Link or identifier (dashboard ID, monitor ID, metric name, incident ID)
|
|
95
|
+
- Owner/author and created/modified date
|
|
96
|
+
- The specific condition, query, or quote that bears on the question (verbatim where possible)
|
|
97
|
+
- Relevance: what this suggests about the target code, and how strong the connection is
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
# Incident & Postmortem Context
|
|
2
|
+
|
|
3
|
+
- **Linear**: look for tickets labeled `incident`, `sev-*`, `postmortem-action-item`, `reliability`
|
|
4
|
+
- **Slack**: search `#sev-*` and `#incident-*` channels around the dates the target code was added
|
|
5
|
+
- **Git**: commits with messages like "fix for incident", "add defensive check", "revert" followed by "re-apply with..." are strong signals
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
# Linear Tickets
|
|
2
|
+
|
|
3
|
+
## What this source contains
|
|
4
|
+
|
|
5
|
+
- Issues describing features, bugs, and their motivation
|
|
6
|
+
- Project docs attached to issues (often PRDs or specs)
|
|
7
|
+
- Parent/sub-issue relationships (broader initiative → specific tickets)
|
|
8
|
+
- Comments on issues (clarifications, scope changes, "why we're doing this" rationale)
|
|
9
|
+
- Labels (e.g., `compliance`, `customer-request`, `perf`) that signal the type of motivation
|
|
10
|
+
- Status updates that explain scope changes
|
|
11
|
+
- Attachments and linked GitHub PRs
|
|
12
|
+
|
|
13
|
+
Linear is where the product/business context often lives: the "we're doing this because customer X asked" or "this is for the Q3 compliance initiative" layer.
|
|
14
|
+
|
|
15
|
+
## How to search it
|
|
16
|
+
|
|
17
|
+
Use the Linear MCP.
|
|
18
|
+
|
|
19
|
+
1. **Start with linked tickets.** If the seed commits or PRs reference ticket IDs (e.g., `ENG-1234`, `[BUG-567]`), fetch those first with `get_issue`. Read the full issue including comments.
|
|
20
|
+
2. **List related issues by keyword.** Use `list_issues` with text search for the feature name, key symbol, or business term. Try multiple phrasings.
|
|
21
|
+
3. **Walk the issue tree.** If you land on a sub-issue, fetch its parent. Sub-issues are tactical. Parents often carry the "why."
|
|
22
|
+
4. **Read project docs.** If the issue belongs to a project, use `get_project` and check attached docs. Project-level documents are where specs and rationale are most often captured.
|
|
23
|
+
5. **Check labels and milestones.** Labels hint at the category of motivation (customer-request, incident-followup, compliance). Milestones tie work to deadlines, which often reveal motivation.
|
|
24
|
+
|
|
25
|
+
## What good evidence looks like here
|
|
26
|
+
|
|
27
|
+
- An issue description stating the business problem: "Customer Acme needs X because of their SOC2 audit"
|
|
28
|
+
- A comment recording a decision: "We decided to go with approach B because approach A would require touching the billing service"
|
|
29
|
+
- A parent issue titled like an initiative: "Q3 Enterprise Readiness" or "Reduce Payment Failures"
|
|
30
|
+
- An attached PRD or spec
|
|
31
|
+
- Labels like `customer:acme`, `incident-followup`, `compliance`, `perf-regression`
|
|
32
|
+
|
|
33
|
+
## Common pitfalls
|
|
34
|
+
|
|
35
|
+
- **Scope drift.** The ticket the PR references may have been closed and reopened with a different scope. Read the whole history.
|
|
36
|
+
- **Mechanical templates.** Some teams require "Why" sections but fill them with boilerplate. Generic text ("improve user experience") is probably not a real answer.
|
|
37
|
+
- **Stale tickets.** Old tickets often reflect a version of the plan that changed. Check dates and cross-reference with the code's ship date.
|
|
38
|
+
- **Closed-as-duplicate chains.** Follow the duplicate-of relationships back to the canonical ticket.
|
|
39
|
+
- **Private workspace content.** If you can't access an issue, note that as a gap rather than guessing.
|
|
40
|
+
|
|
41
|
+
## What to return
|
|
42
|
+
|
|
43
|
+
For each relevant ticket:
|
|
44
|
+
- Ticket ID and title
|
|
45
|
+
- The problem/motivation quoted from the description or comments (not paraphrased. The synthesizer needs the exact text to cite)
|
|
46
|
+
- Labels, parent issue, project
|
|
47
|
+
- Author, created date, closed date
|
|
48
|
+
- Link to the ticket if available
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
# Notion Docs
|
|
2
|
+
|
|
3
|
+
## What this source contains
|
|
4
|
+
|
|
5
|
+
- PRDs (product requirement documents)
|
|
6
|
+
- Technical specs and RFCs
|
|
7
|
+
- Architectural decision records (ADRs)
|
|
8
|
+
- Meeting notes from design reviews
|
|
9
|
+
- Team pages with domain context
|
|
10
|
+
- Postmortems from incidents
|
|
11
|
+
- Runbooks that may explain defensive code
|
|
12
|
+
- Strategy documents that set priorities
|
|
13
|
+
|
|
14
|
+
Notion is where "why" often lives in long-form before it becomes code. A significant feature usually has a doc.
|
|
15
|
+
|
|
16
|
+
## How to search it
|
|
17
|
+
|
|
18
|
+
Use the Notion MCP.
|
|
19
|
+
|
|
20
|
+
1. **Keyword searches with `notion-search`.** Try:
|
|
21
|
+
- The feature name
|
|
22
|
+
- Key symbols / class names from the target code
|
|
23
|
+
- Author handles (design docs are often authored before the code lands)
|
|
24
|
+
- Error strings or user-visible terms
|
|
25
|
+
- Time-bounded queries if you know when the code shipped
|
|
26
|
+
2. **Fetch candidate pages with `notion-fetch`.** Read the full content, not the preview. Rationale is often buried mid-document.
|
|
27
|
+
3. **Follow backlinks and child pages.** Design docs often have sub-pages for alternatives considered, appendices, or implementation notes.
|
|
28
|
+
4. **Check related databases.** `notion-query-data-sources` and `notion-query-meeting-notes` can surface meeting notes that discussed the decision.
|
|
29
|
+
5. **Search author-specific spaces.** If the PR author has a personal notebook (common at some companies), it may hold exploratory thinking that preceded the code.
|
|
30
|
+
|
|
31
|
+
## What good evidence looks like here
|
|
32
|
+
|
|
33
|
+
- A PRD with a "Problem statement" or "Motivation" section that matches the target code's purpose
|
|
34
|
+
- An "Alternatives considered" or "Rejected approaches" section
|
|
35
|
+
- A postmortem that names the target code as the fix for a specific incident
|
|
36
|
+
- Meeting notes that record "we decided X because Y" and tie to the same author/date range as the PR
|
|
37
|
+
- An ADR template filled out non-trivially (status, context, decision, consequences)
|
|
38
|
+
|
|
39
|
+
## Common pitfalls
|
|
40
|
+
|
|
41
|
+
- **Outdated docs.** Specs are often written before implementation and not updated. The doc may describe a plan that changed. Cross-check against the actual PR.
|
|
42
|
+
- **Doc vs. reality drift.** A spec may say "we'll do X" but the code actually does Y. Flag the divergence. The synthesizer will surface the contradiction.
|
|
43
|
+
- **Boilerplate templates.** Some orgs require a "Why" section that gets filled with fluff. Look for specificity.
|
|
44
|
+
- **Unlinked docs.** The most relevant doc may not be linked from anywhere. Broad keyword searches help.
|
|
45
|
+
- **Multiple drafts.** If a topic has multiple docs, find the one that was finalized or most recently updated. Check dates.
|
|
46
|
+
- **Access-restricted pages.** If you can't access a page, note it as a gap.
|
|
47
|
+
|
|
48
|
+
## What to return
|
|
49
|
+
|
|
50
|
+
For each relevant doc:
|
|
51
|
+
- Title and URL
|
|
52
|
+
- Authors and last-updated date
|
|
53
|
+
- The motivation text (verbatim quote), with page/section location
|
|
54
|
+
- Relevant linked pages (so the synthesizer can cite them)
|
|
55
|
+
- Whether the doc was finalized or draft
|