chain-insights 0.2.16
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/LICENSE +21 -0
- package/README.md +165 -0
- package/bin/cli.js +10 -0
- package/bin/install.cjs +252 -0
- package/bin/mcp-proxy.cjs +10 -0
- package/dist/active-BSrxLKwn.mjs +50 -0
- package/dist/active-BSrxLKwn.mjs.map +1 -0
- package/dist/active-Dv7Tu-O4.cjs +68 -0
- package/dist/app-BjjuQM0B.mjs +155 -0
- package/dist/app-BjjuQM0B.mjs.map +1 -0
- package/dist/app-Dq1TdB6p.cjs +161 -0
- package/dist/artifact-server-DoxJ7fCx.cjs +47 -0
- package/dist/artifact-server-Dxz5YbuQ.mjs +48 -0
- package/dist/artifact-server-Dxz5YbuQ.mjs.map +1 -0
- package/dist/assets/bg-pattern.png +0 -0
- package/dist/assets/logo.png +0 -0
- package/dist/call-args-DQA2QcRA.cjs +27 -0
- package/dist/call-args-Lk_wOJxd.mjs +29 -0
- package/dist/call-args-Lk_wOJxd.mjs.map +1 -0
- package/dist/capabilities-CB97WMA5.cjs +83 -0
- package/dist/capabilities-DliMBim-.mjs +84 -0
- package/dist/capabilities-DliMBim-.mjs.map +1 -0
- package/dist/cases-By7INiOa.mjs +6 -0
- package/dist/cases-CDcNU91B.cjs +9 -0
- package/dist/chunk-CZWwpsFl.cjs +43 -0
- package/dist/cli.cjs +752 -0
- package/dist/cli.d.cts +1 -0
- package/dist/cli.d.mts +1 -0
- package/dist/cli.mjs +753 -0
- package/dist/cli.mjs.map +1 -0
- package/dist/client-D4Bq0rp9.mjs +111 -0
- package/dist/client-D4Bq0rp9.mjs.map +1 -0
- package/dist/client-D4fZgIaO.cjs +132 -0
- package/dist/config-Bmdl5hdk.cjs +67 -0
- package/dist/config-BwrBYmiC.mjs +44 -0
- package/dist/config-BwrBYmiC.mjs.map +1 -0
- package/dist/data-extractor-BNGj7ECT.cjs +347 -0
- package/dist/data-extractor-DFzsa5CS.mjs +336 -0
- package/dist/data-extractor-DFzsa5CS.mjs.map +1 -0
- package/dist/dossier-BsroDgD3.mjs +76 -0
- package/dist/dossier-BsroDgD3.mjs.map +1 -0
- package/dist/dossier-DtxREpPm.cjs +76 -0
- package/dist/evidence-BGcdKxuV.cjs +200 -0
- package/dist/evidence-BhvFW-y_.mjs +195 -0
- package/dist/evidence-BhvFW-y_.mjs.map +1 -0
- package/dist/format-Ce1RObVl.mjs +22 -0
- package/dist/format-Ce1RObVl.mjs.map +1 -0
- package/dist/format-DOrPvXEr.cjs +20 -0
- package/dist/frontmatter-D8wWCeOa.mjs +26 -0
- package/dist/frontmatter-D8wWCeOa.mjs.map +1 -0
- package/dist/frontmatter-DgAuai7E.cjs +35 -0
- package/dist/graph-normalizer-Cv9yK9Pg.mjs +130 -0
- package/dist/graph-normalizer-Cv9yK9Pg.mjs.map +1 -0
- package/dist/graph-normalizer-DeIj6Ses.cjs +133 -0
- package/dist/graph-reports-C4TBjCkM.mjs +63 -0
- package/dist/graph-reports-C4TBjCkM.mjs.map +1 -0
- package/dist/graph-reports-DU05YCei.cjs +64 -0
- package/dist/html-generator-CAv81IWH.cjs +85 -0
- package/dist/html-generator-V6Bp0uRb.mjs +68 -0
- package/dist/html-generator-V6Bp0uRb.mjs.map +1 -0
- package/dist/index.cjs +31 -0
- package/dist/index.d.cts +187 -0
- package/dist/index.d.cts.map +1 -0
- package/dist/index.d.mts +187 -0
- package/dist/index.d.mts.map +1 -0
- package/dist/index.mjs +9 -0
- package/dist/init-BjuFt54X.cjs +232 -0
- package/dist/init-CaOsHTIo.mjs +232 -0
- package/dist/init-CaOsHTIo.mjs.map +1 -0
- package/dist/mcp-proxy.cjs +1257 -0
- package/dist/mcp-proxy.d.cts +12 -0
- package/dist/mcp-proxy.d.cts.map +1 -0
- package/dist/mcp-proxy.d.mts +12 -0
- package/dist/mcp-proxy.d.mts.map +1 -0
- package/dist/mcp-proxy.mjs +1255 -0
- package/dist/mcp-proxy.mjs.map +1 -0
- package/dist/output-root-CFYms3ad.cjs +43 -0
- package/dist/output-root-CmWM7aV2.mjs +33 -0
- package/dist/output-root-CmWM7aV2.mjs.map +1 -0
- package/dist/parser-BUIWW1OH.cjs +182 -0
- package/dist/parser-DO0_SssG.mjs +182 -0
- package/dist/parser-DO0_SssG.mjs.map +1 -0
- package/dist/public-tools-D4UI-Zb0.mjs +2554 -0
- package/dist/public-tools-D4UI-Zb0.mjs.map +1 -0
- package/dist/public-tools-XSpkz2ky.cjs +2556 -0
- package/dist/resolver-C2ZS7oC8.mjs +201 -0
- package/dist/resolver-C2ZS7oC8.mjs.map +1 -0
- package/dist/resolver-zYbu4wDV.cjs +203 -0
- package/dist/rolldown-runtime-wcPFST8Q.mjs +13 -0
- package/dist/runner-1Eq55OYb.cjs +148 -0
- package/dist/runner-BhUHbiHG.mjs +149 -0
- package/dist/runner-BhUHbiHG.mjs.map +1 -0
- package/dist/schema-4XpzDFQM.cjs +55 -0
- package/dist/schema-8d0rVIdZ.mjs +37 -0
- package/dist/schema-8d0rVIdZ.mjs.map +1 -0
- package/dist/schema-cache-9CksD7tX.mjs +34 -0
- package/dist/schema-cache-9CksD7tX.mjs.map +1 -0
- package/dist/schema-cache-CgWRCN2N.cjs +36 -0
- package/dist/selector-CkFcTXzz.cjs +10 -0
- package/dist/selector-xjm6NTHI.mjs +12 -0
- package/dist/selector-xjm6NTHI.mjs.map +1 -0
- package/dist/server-BkM5xrXb.mjs +45 -0
- package/dist/server-BkM5xrXb.mjs.map +1 -0
- package/dist/server-DXowbpfi.cjs +54 -0
- package/dist/session-BpNylyuJ.cjs +115 -0
- package/dist/session-CcTgYxsj.mjs +115 -0
- package/dist/session-CcTgYxsj.mjs.map +1 -0
- package/dist/setup-DOpKPrlx.cjs +81 -0
- package/dist/setup-DyrWHuwQ.mjs +80 -0
- package/dist/setup-DyrWHuwQ.mjs.map +1 -0
- package/dist/store-BiUhQOIf.cjs +230 -0
- package/dist/store-BoWE-Gtl.mjs +225 -0
- package/dist/store-BoWE-Gtl.mjs.map +1 -0
- package/dist/templates/graph.html +1406 -0
- package/dist/tool-visibility-3Z_KvO9Q.mjs +28 -0
- package/dist/tool-visibility-3Z_KvO9Q.mjs.map +1 -0
- package/dist/tool-visibility-CwgY205r.cjs +36 -0
- package/dist/tools-Cp2jAAAb.mjs +100 -0
- package/dist/tools-Cp2jAAAb.mjs.map +1 -0
- package/dist/tools-f_vJUZAF.cjs +139 -0
- package/dist/topup-server-BZuQifvh.cjs +940 -0
- package/dist/topup-server-DUjyFftI.mjs +919 -0
- package/dist/topup-server-DUjyFftI.mjs.map +1 -0
- package/dist/version-1gP19Lhi.mjs +8 -0
- package/dist/version-1gP19Lhi.mjs.map +1 -0
- package/dist/version-BNGtdpmH.cjs +18 -0
- package/dist/viz-BlCJe6Tk.mjs +35 -0
- package/dist/viz-BlCJe6Tk.mjs.map +1 -0
- package/dist/viz-ClezVXrJ.cjs +44 -0
- package/dist/wallet-BMelXBYP.mjs +104 -0
- package/dist/wallet-BMelXBYP.mjs.map +1 -0
- package/dist/wallet-RnvvSpV2.cjs +146 -0
- package/docs/architecture.md +145 -0
- package/docs/contributing.md +68 -0
- package/docs/debugging.md +68 -0
- package/docs/development.md +44 -0
- package/docs/graph-tools.md +251 -0
- package/docs/images/graph-mcp-iframe.png +0 -0
- package/docs/images/graph-visualization.png +0 -0
- package/docs/images/topup-page.png +0 -0
- package/docs/investigation-workspaces.md +151 -0
- package/docs/mcp-proxy.md +180 -0
- package/package.json +59 -0
- package/skills/chain-insights-developer-experience/SKILL.md +101 -0
- package/skills/chain-insights-investigation/SKILL.md +285 -0
- package/skills/chain-insights-investigation/agents/openai.yaml +4 -0
- package/skills/chain-insights-investigation/scripts/run-target-uat.sh +197 -0
- package/skills/chain-insights-trace-funds/SKILL.md +249 -0
- package/skills/ci-case/SKILL.md +43 -0
- package/skills/ci-status/SKILL.md +45 -0
- package/skills/test-chain-insights-graphrag-mcp/SKILL.md +75 -0
- package/skills/test-chain-insights-graphrag-mcp/agents/openai.yaml +4 -0
- package/skills/test-chain-insights-graphrag-mcp/scripts/run-uat.sh +414 -0
|
@@ -0,0 +1,249 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: chain-insights-trace-funds
|
|
3
|
+
description: Use when tracing stolen funds to exchange deposit candidates in Chain Insights. Explains the public track_funds workflow, traceback/source discovery, address aliases, compact evidence pointers, and graph/report outputs.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Chain Insights Fund Flow Tracking
|
|
7
|
+
|
|
8
|
+
This compatibility skill file documents the public Chain Insights fund-flow
|
|
9
|
+
workflow. Use the `track_funds` MCP tool for stolen-fund tracing, victim/source
|
|
10
|
+
fund-flow analysis, and exchange-deposit candidate discovery.
|
|
11
|
+
|
|
12
|
+
Before running investigation-producing commands, confirm the current directory
|
|
13
|
+
is an initialized Chain Insights workspace:
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
test -f .chain-insights/workspace.json && cat .chain-insights/workspace.json
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
If that file is missing, stop and tell the user to run:
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
cia init .
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
No investigation output belongs under `~/.chain-insights`; that global location
|
|
26
|
+
is for config, cache, wallet, and installed skills only.
|
|
27
|
+
|
|
28
|
+
Before selecting a tracing method, inspect the live GraphRAG network matrix:
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
cia mcp networks
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
Use the output as the source of truth:
|
|
35
|
+
|
|
36
|
+
- `Topology: yes` is required for fund-flow tracing.
|
|
37
|
+
- `Available tools` must include `track_funds`; otherwise use `graph_query` or
|
|
38
|
+
`graph_query_batch` with `USE live_topology` for manual topology diagnostics.
|
|
39
|
+
- `Dataset` gives the graph coverage range as
|
|
40
|
+
`<first_height>..<last_height> / <first_date>..<last_date>`. State this range
|
|
41
|
+
in the investigation scope, and do not claim tracing coverage outside it.
|
|
42
|
+
- `Risk: yes` is not required for `track_funds`, but it determines whether
|
|
43
|
+
downstream `address_risk` enrichment is available on the same network.
|
|
44
|
+
|
|
45
|
+
Use `track_funds` when the investigation has victim/source addresses and may
|
|
46
|
+
also include known scammer addresses. It accepts up to five
|
|
47
|
+
`trusted_addresses` and up to five `untrusted_addresses`, preserves those
|
|
48
|
+
roles, and runs the local tracing engine per address.
|
|
49
|
+
|
|
50
|
+
Use `scam_topology` when the user has known victim incident ground truth and
|
|
51
|
+
wants to derive ML-ready `scam_labels` plus reviewable laundering context.
|
|
52
|
+
`track_funds` answers where funds went; `scam_topology` answers which outward
|
|
53
|
+
victim incident topology, laundering intermediates, exchange deposit
|
|
54
|
+
candidates, exchange endpoints, and generic context boundaries were observed.
|
|
55
|
+
The victim-only traversal is outward from victim/source funds; it does not
|
|
56
|
+
query or promote victim inbound transfers as scam infrastructure.
|
|
57
|
+
The primary traversal is a node-relative novelty wave: each new node expands
|
|
58
|
+
only once, repeated targets are retained as non-expanding `convergence_edge`
|
|
59
|
+
context, and downstream edges must have `first_seen_timestamp` or
|
|
60
|
+
`last_seen_timestamp` greater than or equal to the current node's wave-arrival
|
|
61
|
+
timestamp. The tool can instead use `activity_policy=global_incident_only`,
|
|
62
|
+
where every wave is filtered against `incident_timestamp_ms`. Exchange terminal safety
|
|
63
|
+
is the only hard-coded terminal behavior; non-exchange labels are context hints.
|
|
64
|
+
Victim/source addresses are not risky labels. The tool returns `label_candidates`
|
|
65
|
+
for analyst review; candidates are reviewable, not automatic writes to
|
|
66
|
+
`core_address_labels`. Its graph report uses the same `chain-insights.graph.v1`
|
|
67
|
+
layout as `track_funds`: primary victim-flow edges are `flows`, exchange
|
|
68
|
+
deposits are `deposits`, and deposit-cluster enrichment is represented as
|
|
69
|
+
`reverse_leads`.
|
|
70
|
+
|
|
71
|
+
```bash
|
|
72
|
+
cia mcp scam-topology --network bittensor --victim-address 5... --incident-timestamp-ms 1715532228001 --max-hops 16
|
|
73
|
+
cia mcp scam-topology --network bittensor --victim-address 5... --incident-timestamp-ms 1715532228001 --max-hops 16 --activity-policy global_incident_only
|
|
74
|
+
cia mcp scam-topology --network bittensor --victim-address 5... --incident-timestamp-ms 1715532228001 --case 1
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
When `case_id` or CLI `--case` is present, `scam_topology` mirrors
|
|
78
|
+
`track_funds` case behavior: it appends a compact
|
|
79
|
+
`chain-insights.evidence_pointer.v1` entry that points at workspace-local
|
|
80
|
+
compact evidence JSON, graph JSON, graph HTML, label-candidate CSV, and
|
|
81
|
+
Markdown report files.
|
|
82
|
+
|
|
83
|
+
Use `track_funds` for a single address by passing that address as the only
|
|
84
|
+
`trusted_addresses` value. The workflow is a TypeScript port of the probe
|
|
85
|
+
workflow, not a simple top-K hop walker. The goal is to find all reachable
|
|
86
|
+
exchange-deposit paths the graph can return within query limits, then traceback
|
|
87
|
+
those deposits toward source exchanges and enrich the result with reverse 1-hop
|
|
88
|
+
leads.
|
|
89
|
+
|
|
90
|
+
Python GraphRAG MCP is the golden implementation. Do not degrade this workflow
|
|
91
|
+
into a simple top-K neighbor recipe. When Chain Insights runs against the Go
|
|
92
|
+
Graph MCP, it should still reproduce Python `BFSOps` and `StolenFundsProbe`
|
|
93
|
+
semantics by issuing read-only `graph_query_batch` calls with `USE live_topology`.
|
|
94
|
+
|
|
95
|
+
Current MemGQL does not parse Memgraph `*BFS` or variable-length relationship
|
|
96
|
+
syntax. Against Go Graph MCP, exchange-deposit discovery therefore uses
|
|
97
|
+
generated fixed-depth `FLOWS_TO` query batches up to the requested hop limit,
|
|
98
|
+
requires `t.is_exchange IS NOT NULL`, prevents intermediate exchange hops, and
|
|
99
|
+
treats the penultimate address as the deposit candidate.
|
|
100
|
+
|
|
101
|
+
This tool exists so the agent does not lose the investigation in chat context.
|
|
102
|
+
It executes the repeatable tracing loop, stores machine-readable files for
|
|
103
|
+
visualization, writes a human report, and returns compact facts plus an
|
|
104
|
+
`address_map` so the agent can reason with aliases instead of repeatedly
|
|
105
|
+
copying full blockchain addresses.
|
|
106
|
+
|
|
107
|
+
## Tool
|
|
108
|
+
|
|
109
|
+
Preferred multi-address call:
|
|
110
|
+
|
|
111
|
+
```text
|
|
112
|
+
track_funds
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
Required inputs:
|
|
116
|
+
|
|
117
|
+
- `trusted_addresses`: comma-separated full victim/source addresses, max 5.
|
|
118
|
+
- `network`: required network. Do not guess.
|
|
119
|
+
|
|
120
|
+
Optional inputs:
|
|
121
|
+
|
|
122
|
+
- `untrusted_addresses`: comma-separated full known scammer addresses, max 5.
|
|
123
|
+
- `case_id`: when present, per-address evidence stores compact pointers to reports.
|
|
124
|
+
- `max_hops`, `per_address_limit`, `min_amount_sum`: forwarded to the single-seed tracing engine.
|
|
125
|
+
|
|
126
|
+
Single-address call:
|
|
127
|
+
|
|
128
|
+
Call:
|
|
129
|
+
|
|
130
|
+
```text
|
|
131
|
+
track_funds
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
Required inputs:
|
|
135
|
+
|
|
136
|
+
- `trusted_addresses`: one full source/victim address to trace from.
|
|
137
|
+
- `network`: required network. Do not guess.
|
|
138
|
+
|
|
139
|
+
Optional inputs:
|
|
140
|
+
|
|
141
|
+
- `case_id`: when present, evidence stores a compact pointer to report/table/graph files.
|
|
142
|
+
- `max_hops`: legacy compatibility knob; probe-style exchange search is bounded primarily by query timeout and result limits.
|
|
143
|
+
- `per_address_limit`: controls the forward exchange path result budget.
|
|
144
|
+
- `min_amount_sum`: optional minimum original graph `r.amount_sum`.
|
|
145
|
+
|
|
146
|
+
## Behind The Scenes
|
|
147
|
+
|
|
148
|
+
The tool:
|
|
149
|
+
|
|
150
|
+
1. Captures runtime graph schema if missing:
|
|
151
|
+
- `.chain-insights/schema/<network>.graph-schema.json`
|
|
152
|
+
2. Runs Python-probe-style forward exchange path query batches:
|
|
153
|
+
- generated fixed-depth `MATCH (s)-[r1:FLOWS_TO]->...->(t)` queries
|
|
154
|
+
because current MemGQL rejects `*BFS` and `*1..N` syntax,
|
|
155
|
+
- excludes paths that traverse through an intermediate exchange,
|
|
156
|
+
- records node and relationship projections,
|
|
157
|
+
- treats `path[-2]` as the exchange deposit candidate.
|
|
158
|
+
3. Runs traceback/source discovery:
|
|
159
|
+
- generated fixed-depth backward reads from each deposit toward source exchanges,
|
|
160
|
+
- reverse 1-hop from deposits to surface leads,
|
|
161
|
+
- lead reasons include labeled entity, fan-in hub, or high-volume sender.
|
|
162
|
+
4. Assigns aliases:
|
|
163
|
+
- `V*` seed/victim/source address,
|
|
164
|
+
- `D*` deposit candidates,
|
|
165
|
+
- `E*` forward exchange endpoints,
|
|
166
|
+
- `X*` traceback source exchanges,
|
|
167
|
+
- `L*` reverse 1-hop leads,
|
|
168
|
+
- `I*` intermediaries.
|
|
169
|
+
5. Writes workspace-local reports:
|
|
170
|
+
- `reports/graphs/*.graph.json`
|
|
171
|
+
- served by the local Hono server at `/graph-reports/<filename>.graph.json`
|
|
172
|
+
- `reports/*.graph.html`
|
|
173
|
+
- `reports/tables/*.compact-evidence.json`
|
|
174
|
+
- `reports/tables/*.flows.csv`
|
|
175
|
+
- `reports/*.table.html`
|
|
176
|
+
- `reports/*.trace-report.md`
|
|
177
|
+
6. Returns:
|
|
178
|
+
- concise facts,
|
|
179
|
+
- `address_map` alias-to-address mapping,
|
|
180
|
+
- file paths,
|
|
181
|
+
- graph app metadata,
|
|
182
|
+
- deposit, exchange, traceback, and lead summaries.
|
|
183
|
+
|
|
184
|
+
Case evidence should stay compact. It should point to report files and include
|
|
185
|
+
hashable provenance/facts, not paste the full graph/table JSON into markdown.
|
|
186
|
+
The JSON/CSV/Markdown reports carry the investigation structure.
|
|
187
|
+
|
|
188
|
+
## Field Discipline
|
|
189
|
+
|
|
190
|
+
Evidence and generated data files must use original graph field names. Do not
|
|
191
|
+
rename, reinterpret, or add unit labels unless the schema or query result
|
|
192
|
+
explicitly supports that interpretation.
|
|
193
|
+
|
|
194
|
+
For this tracing workflow, asset classification is not needed to identify
|
|
195
|
+
exchange deposit candidates. The tool focuses on path shape,
|
|
196
|
+
source/destination addresses, exchange labels, aliases, `amount_sum`,
|
|
197
|
+
`amount_usd_sum`, tx counts, and tx ids.
|
|
198
|
+
|
|
199
|
+
## Agent Continuation Logic
|
|
200
|
+
|
|
201
|
+
After `track_funds` returns:
|
|
202
|
+
|
|
203
|
+
1. Read the summary and file paths.
|
|
204
|
+
2. Use `address_map` in reasoning and prose, but preserve full addresses when
|
|
205
|
+
writing evidence, graph JSON, tables, and reports.
|
|
206
|
+
3. If `continuation.depositAddresses` is non-empty, those are evidence-backed
|
|
207
|
+
exchange deposit candidates discovered so far.
|
|
208
|
+
4. Do not stop the investigation just because one exchange was found. Forward
|
|
209
|
+
exchange paths, traceback source paths, and reverse leads are separate
|
|
210
|
+
signals.
|
|
211
|
+
5. Do not continue through `Exchange` nodes. Traceback goes backward from
|
|
212
|
+
deposit candidates; forward tracing terminates each exchange branch.
|
|
213
|
+
6. If the user asks "where did it go?", answer with deposit candidates and
|
|
214
|
+
exchange endpoints first, then traceback source exchanges and leads.
|
|
215
|
+
|
|
216
|
+
Do not expand dossiers with long prose. Dossiers should contain short pointers
|
|
217
|
+
to the report and evidence files. The report and graph JSON carry the actual
|
|
218
|
+
investigation structure.
|
|
219
|
+
|
|
220
|
+
## Manual Topology Query
|
|
221
|
+
|
|
222
|
+
Only hand-write `graph_query_batch` when the tool is unavailable or a custom
|
|
223
|
+
question is outside simple outbound fund tracing. Prefix topology queries with
|
|
224
|
+
`USE live_topology`.
|
|
225
|
+
|
|
226
|
+
Manual forward exchange path pattern:
|
|
227
|
+
|
|
228
|
+
```cypher
|
|
229
|
+
MATCH (s:Address {address: "<full-address>"})
|
|
230
|
+
-[r1:FLOWS_TO]->(n1:Address)
|
|
231
|
+
-[r2:FLOWS_TO]->(t:Address)
|
|
232
|
+
WHERE t.is_exchange IS NOT NULL
|
|
233
|
+
AND s <> t
|
|
234
|
+
AND n1.is_exchange IS NULL
|
|
235
|
+
AND r1.amount_sum IS NOT NULL
|
|
236
|
+
AND r2.amount_sum IS NOT NULL
|
|
237
|
+
RETURN
|
|
238
|
+
[s.address, n1.address, t.address] AS addresses,
|
|
239
|
+
[s.labels, n1.labels, t.labels] AS node_labels,
|
|
240
|
+
[
|
|
241
|
+
{amount_sum: r1.amount_sum, amount_usd_sum: r1.amount_usd_sum, tx_count: r1.tx_count},
|
|
242
|
+
{amount_sum: r2.amount_sum, amount_usd_sum: r2.amount_usd_sum, tx_count: r2.tx_count}
|
|
243
|
+
] AS edge_props,
|
|
244
|
+
t.address AS exchange_address,
|
|
245
|
+
t.labels AS exchange_labels,
|
|
246
|
+
2 AS hops
|
|
247
|
+
ORDER BY hops ASC
|
|
248
|
+
LIMIT 200
|
|
249
|
+
```
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: ci-case
|
|
3
|
+
description: "Manage Chain Insights investigation cases (open, activate, suspend, close)"
|
|
4
|
+
allowed-tools:
|
|
5
|
+
- Read
|
|
6
|
+
- Write
|
|
7
|
+
- Bash
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# /ci-case
|
|
11
|
+
|
|
12
|
+
Manage investigation cases. Open new cases, switch active cases, suspend work-in-progress, or close completed investigations.
|
|
13
|
+
|
|
14
|
+
Run case commands from an initialized Chain Insights workspace. If
|
|
15
|
+
`.chain-insights/workspace.json` is missing, initialize the current project
|
|
16
|
+
folder first:
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
cia init .
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
Cases live under the workspace `cases/` directory. Global `~/.chain-insights`
|
|
23
|
+
is reserved for config, cache, wallet, and installed skills; it is not the
|
|
24
|
+
investigation root.
|
|
25
|
+
|
|
26
|
+
## Usage
|
|
27
|
+
|
|
28
|
+
- `/ci-case open <name>`: open a new workspace-local investigation case.
|
|
29
|
+
- `/ci-case status`: show active and open cases in the current workspace.
|
|
30
|
+
- `/ci-case suspend`: suspend the active workspace case.
|
|
31
|
+
- `/ci-case close <name>`: close a workspace case.
|
|
32
|
+
|
|
33
|
+
## CLI Equivalents
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
cia case open "<name>" --tags "<network-or-topic>"
|
|
37
|
+
cia case list
|
|
38
|
+
cia case show <case-number>
|
|
39
|
+
cia case session start <case-number> "session title"
|
|
40
|
+
cia case session end <case-number> --findings "..." --next-steps "..."
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
Use numbered selectors from `cia case list` when a command accepts a case.
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: ci-status
|
|
3
|
+
description: "Show Chain Insights toolkit status, database health, and active cases"
|
|
4
|
+
allowed-tools:
|
|
5
|
+
- Read
|
|
6
|
+
- Bash
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# /ci-status
|
|
10
|
+
|
|
11
|
+
Shows Chain Insights status for the current workspace: workspace metadata,
|
|
12
|
+
configured MCP endpoints, local server health, and case/session context when
|
|
13
|
+
available.
|
|
14
|
+
|
|
15
|
+
Run from an initialized workspace. If `.chain-insights/workspace.json` is
|
|
16
|
+
missing, run:
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
cia init .
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
The workspace is the investigation root. `~/.chain-insights` is only for global
|
|
23
|
+
configuration, cache, wallet, and installed skills; do not treat it as the case,
|
|
24
|
+
report, schema, or log root.
|
|
25
|
+
|
|
26
|
+
## Usage
|
|
27
|
+
|
|
28
|
+
`/ci-status`
|
|
29
|
+
|
|
30
|
+
## What it does
|
|
31
|
+
|
|
32
|
+
1. Confirms `.chain-insights/workspace.json` exists in the workspace.
|
|
33
|
+
2. Runs `cia status` or `chain-insights status` via Bash.
|
|
34
|
+
3. Reads workspace `.chain-insights/` metadata and runtime files when present.
|
|
35
|
+
4. Lists workspace cases with `cia case list`.
|
|
36
|
+
5. Reports server and MCP endpoint configuration without writing investigation output globally.
|
|
37
|
+
|
|
38
|
+
## Example output
|
|
39
|
+
|
|
40
|
+
```
|
|
41
|
+
Workspace: /home/user/investigations/case-42
|
|
42
|
+
Cases: /home/user/investigations/case-42/cases
|
|
43
|
+
Reports: /home/user/investigations/case-42/reports
|
|
44
|
+
Server: http://127.0.0.1:4321
|
|
45
|
+
```
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: test-chain-insights-graphrag-mcp
|
|
3
|
+
description: Run real local UAT for Chain Insights against the GraphRAG MCP server. Use when validating Chain Insights MCP proxy compatibility with GraphRAG MCP, debug bearer auth, graph report storage, TTL-safe graph payloads, local Hono graph report serving, CLI graph_query, public proxy tool registration, or before claiming Chain Insights and GraphRAG MCP are integrated.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
<objective>
|
|
7
|
+
Validate Chain Insights against the real local GraphRAG MCP endpoint with commands, not invented playbooks or mocked output.
|
|
8
|
+
</objective>
|
|
9
|
+
|
|
10
|
+
<quick_start>
|
|
11
|
+
Run the bundled UAT script from the skill directory or by path:
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
skills/test-chain-insights-graphrag-mcp/scripts/run-uat.sh
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
The script writes raw MCP responses and a summary under `chain-insights/.tmp/uat/`.
|
|
18
|
+
It creates and uses a temporary initialized Chain Insights workspace for all
|
|
19
|
+
investigation-producing commands.
|
|
20
|
+
</quick_start>
|
|
21
|
+
|
|
22
|
+
<defaults>
|
|
23
|
+
- Chain Insights repo: `/home/aphex5/work/chain-insights`
|
|
24
|
+
- GraphRAG compose root: `/home/aphex5/work/rbmk/repos/ml`
|
|
25
|
+
- GraphRAG repo: `/home/aphex5/work/rbmk/repos/ml/graphrag`
|
|
26
|
+
- MCP endpoint: `http://localhost:8012/mcp`
|
|
27
|
+
- Debug bearer token: `chain-insights-dev-debug`
|
|
28
|
+
- Chain Insights local server port: `4321`
|
|
29
|
+
- UAT address: `5Ccmf1dJKzGtXX7h17eN72MVMRsFwvYjPVmkXPUaapczECf6`
|
|
30
|
+
</defaults>
|
|
31
|
+
|
|
32
|
+
<environment_overrides>
|
|
33
|
+
Override defaults with environment variables:
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
CHAIN_INSIGHTS_DIR=/path/to/chain-insights \
|
|
37
|
+
GRAPHRAG_ML_DIR=/path/to/rbmk/repos/ml \
|
|
38
|
+
GRAPHRAG_DIR=/path/to/rbmk/repos/ml/graphrag \
|
|
39
|
+
GRAPHRAG_MCP_ENDPOINT=http://localhost:8012/mcp \
|
|
40
|
+
GRAPHRAG_DEBUG_TOKEN=chain-insights-dev-debug \
|
|
41
|
+
CHAIN_INSIGHTS_SERVER_PORT=4321 \
|
|
42
|
+
UAT_ADDRESS=5Ccmf1dJKzGtXX7h17eN72MVMRsFwvYjPVmkXPUaapczECf6 \
|
|
43
|
+
skills/test-chain-insights-graphrag-mcp/scripts/run-uat.sh
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
Set `SKIP_BUILD=1` only when deliberately reusing an existing Chain Insights `dist/`.
|
|
47
|
+
</environment_overrides>
|
|
48
|
+
|
|
49
|
+
<uat_contract>
|
|
50
|
+
The UAT must verify all of these facts:
|
|
51
|
+
|
|
52
|
+
- GraphRAG direct MCP exposes `network_capabilities`, `graph_query`, and `graph_query_batch` through debug bearer auth.
|
|
53
|
+
- If GraphRAG direct MCP also exposes high-level `address_risk`, that direct tool succeeds, returns `content` text and `structuredContent.schema = chain-insights.result.v1`, does not expose `app_data`, `nodes`, `edges`, `flows`, `edge_anchors`, or `transfers` in `structuredContent`, and puts graph data only in `_meta.chainInsights.graph.data`.
|
|
54
|
+
- If GraphRAG direct MCP is primitive-only, Chain Insights proxy high-level tools are still mandatory and must build their graph reports from the primitive graph path.
|
|
55
|
+
- Chain Insights proxy `tools/list` exposes local `balance`, `help`, `address_risk`, `track_funds`, and `scam_topology`, plus public proxied GraphRAG tools.
|
|
56
|
+
- `chain-insights mcp networks` reports each supported network with topology support, risk support, available tools, and dataset height/date coverage when the GraphRAG endpoint exposes it.
|
|
57
|
+
- Chain Insights proxy tool descriptions must not contain stale `app_data` wording after schema refresh.
|
|
58
|
+
- Chain Insights proxy `address_risk` returns only local graph report metadata in `_meta.chainInsights.graph = { schema, url }`.
|
|
59
|
+
- Chain Insights proxy response must not include `_meta.chainInsights.graph.data`.
|
|
60
|
+
- The local graph report URL must be served by the Chain Insights Hono server at `/graph-reports/<filename>.graph.json` and return `chain-insights.graph.v1` JSON without `transfers`.
|
|
61
|
+
- `chain-insights mcp call graph_query` with `USE live_topology` must hit the real GraphRAG/MemGQL path and return the UAT address.
|
|
62
|
+
- No investigation output is created under `~/.chain-insights/reports` or `~/.chain-insights/cases`.
|
|
63
|
+
</uat_contract>
|
|
64
|
+
|
|
65
|
+
<process>
|
|
66
|
+
1. Run the script. Do not replace it with hand-written equivalent commands unless the script itself is being fixed.
|
|
67
|
+
2. Read the summary path printed by the script.
|
|
68
|
+
3. Report pass/fail from the script output and include the raw response paths for reproducibility.
|
|
69
|
+
4. If a step fails because `x402 payment is temporarily unavailable`, verify the debug bearer token config and rerun with `GRAPHRAG_DEBUG_TOKEN`.
|
|
70
|
+
5. If a port is already in use, the script reuses a healthy local server and only stops a server it started itself.
|
|
71
|
+
</process>
|
|
72
|
+
|
|
73
|
+
<success_criteria>
|
|
74
|
+
UAT is complete only when the script exits `0`, reports every assertion as passed, and the final answer states the report path and any residual unrelated repo health issues separately from UAT status.
|
|
75
|
+
</success_criteria>
|