[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M69BGJKYX9KX5RAYSPRYDVMG":3,"skill-same:01M69BGJKYX9KX5RAYSPRYDVMG":67},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":8,"repositoryFullName":9,"ownerLogin":10,"ownerAvatarUrl":11,"ownerAccountNo":12,"ownerDisplayName":13,"repositoryNo":14,"starsCount":15,"licenseSpdxId":16,"licenseFileUrl":17,"sourceHtmlUrl":18,"categories":19,"keywords":30,"publishedAt":32,"linkOnly":33,"markdownContent":34,"markdownBody":35,"frontMatter":36,"refName":44,"commitSha":45,"skillDirectory":46,"forksCount":47,"repositoryHtmlUrl":48,"repositoryHomepageUrl":17,"ownerHtmlUrl":49,"ownerBlogUrl":50,"ownerDescription":51,"updatedAt":52,"install":53,"resources":66},"01M69BGJKYX9KX5RAYSPRYDVMG","context-intelligence-gds","Neo4j GDS 图算法分析","Use when about to write naive Cypher for a graph-topology question — pathfinding, reachability, centrality\u002Finfluence, community\u002Fclustering, structural similarity, or similar event paths\u002Ftrajectories (with\u002Fwithout time) — reach for Neo4j GDS or APOC instead of hand-rolling traversals one hop at a time. WHEN\u002FWHY layer; graph-query's \"Push Work to the Database\" section is the HOW.","当正要为图拓扑问题编写朴素的 Cypher 时使用——寻路、可达性、中心性\u002F影响力、社区\u002F聚类、结构相似度，或相似的事件路径\u002F轨迹（含或不含时间维度）——应改用 Neo4j GDS 或 APOC，而不是手动逐跳编写遍历。本技能属于 WHEN\u002FWHY 层；graph-query 的 'Push Work to the Database' 章节是 HOW 层。","microsoft\u002Famplifier-bundle-context-intelligence","microsoft","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F6154722?v=4","01M698VYDXZ6JW5WH3CRV650R8","Microsoft","01M69BGBVCCWXG1MNNF1E8TCWN",5,"MIT",null,"https:\u002F\u002Fgithub.com\u002Fmicrosoft\u002Famplifier-bundle-context-intelligence\u002Fblob\u002Fmain\u002Fskills\u002Fcontext-intelligence-gds\u002FSKILL.md",[20,25],{"categoryNo":21,"categoryName":22,"taxonomyType":23,"taxonomyTypeDesc":24},"01M8BTGTEHKD89NSZ5CT4Y5AGV","数据工程师","PROFESSION","适用职业",{"categoryNo":26,"categoryName":27,"taxonomyType":28,"taxonomyTypeDesc":29},"01M8C6FB1ZVYJ10YW5GZSBMFT4","上下文智能图分析","SCENARIO","使用场景",[31],"context intelligence gds","2026-11-10 10:12:30",false,"---\nname: context-intelligence-gds\ndescription: >\n  Use when about to write naive Cypher for a graph-topology question — pathfinding,\n  reachability, centrality\u002Finfluence, community\u002Fclustering, structural similarity,\n  or similar event paths\u002Ftrajectories (with\u002Fwithout time) — reach for Neo4j GDS or\n  APOC instead of hand-rolling traversals one hop at a time. WHEN\u002FWHY layer;\n  graph-query's \"Push Work to the Database\" section is the HOW.\nlicense: MIT\nmetadata:\n  version: \"1.2.0\"\n  changelog:\n    - \"1.2.0: Lifted patterns from a real graph exploration — TF-IDF weighting to defeat glue-tool dominance in similarity; read-only vector-property gds.knn fallback (no bipartite edges); a derived co-occurrence\u002Fteaming projection (distinct from the edge-less Agent-node dead end); apoc.map.fromPairs\u002Fapoc.coll.sort as a fourth primitive (in-graph frequency map); a read-only .stream\u002F.stats vs .write\u002F.mutate guardrail; and a 'When GDS itself isn't enough' boundary (structure vs intent → escalate to LLM embeddings).\"\n    - \"1.1.0: Added the 'Complex topology searches' section — centrality, topological\u002Fstructural similarity (nodeSimilarity\u002FKNN\u002FFastRP embeddings), and similar event PATHS \u002F trajectories with-or-without a time dimension (set-similarity vs transition-signature), plus pathfinding and a non-lineage projection recipe. These are the hard searches the skill exists to route off naive Cypher.\"\n    - \"1.0.0: Initial — GDS\u002FAPOC scenario-selection and advantages, avoid-naive-Cypher decision map, three reusable primitives tuned to this graph.\"\n---\n\n# Context Intelligence — Graph Data Science First\n\nThe context-intelligence graph is large (millions of nodes across thousands of\nsessions). Naive Cypher tends to **re-derive, one hop and one round-trip at a time,\nwhat a graph algorithm computes in a single server-side pass**. This skill trains the\nreflex: recognize the *shape* of the question, and when it is a graph-algorithm shape,\nreach for **GDS or APOC** instead of improvising Cypher.\n\n> **This skill is WHEN and WHY. The HOW lives next door.** The graph-query skill owns\n> the schema meaning, the traps, and the worked projection queries — its **Section 8,\n> \"Push Work to the Database (APOC \u002F GDS)\"** has the concrete `gds.graph.project →\n> algorithm → gds.graph.drop` lifecycle and the `Session`\u002F`FORKED` + agent-rollup\n> example. Load `context-intelligence-graph-query` for mechanics; use this skill to\n> decide *whether the algorithm is the right tool at all.*\n\n---\n\n## The naive-query smell test\n\nYou are probably about to write naive Cypher where GDS\u002FAPOC would be better if you catch\nyourself doing any of these:\n\n- **Guessing edge types to walk a tree** (`-[:HAS_SUBSESSION|FORKED|HAS_FORK]->`) or\n  repeatedly stepping `Session.parent_id` one hop at a time to rebuild a delegation tree.\n- **`collect()` then `size([x IN … WHERE …])`** to count how many things are reachable \u002F\n  match — reconstructing an algorithm's output by hand.\n- **A giant `WHERE node_id IN [ …50 literals… ]`** pasted into the query text (client-side\n  set-building shoved into Cypher).\n- **`UNWIND range(0, size(list)-2)`** to compute consecutive gaps \u002F pairwise math.\n- **Variable-length `-[*1..n]->`** followed by client-side filtering of the paths.\n- Pulling many rows to the client to **iterate and aggregate** what the DB could reduce.\n\nEach of these is a tell that the question has a *graph-algorithm shape*.\n\n---\n\n## What the graph-data-science package buys you (the advantages)\n\n| Advantage | Naive Cypher | GDS \u002F APOC |\n|---|---|---|\n| **One pass, not many round-trips** | N queries + client stitching | project once, compute server-side, return a bounded result |\n| **Scales to the whole graph** | degrades \u002F times out on deep or wide traversals | algorithms are built for millions of nodes |\n| **Correct, not approximate** | hand-rolled shortest-path \u002F \"influence\" is easy to get subtly wrong | `gds.shortestPath`, `gds.pageRank`, `gds.betweenness` are the real thing |\n| **Less context churn** | large client-side pulls flood the session | the payload never crosses the wire; only the answer does |\n| **Stable, reusable shapes** | every question becomes a new bespoke query | a handful of parameterized primitives cover most questions |\n\n---\n\n## Best-fit scenarios → the right tool\n\nMatch the *question shape* to the tool. This is the core of the skill.\n\n| The question is really… | Naive trap | Reach for | Why it wins |\n|---|---|---|---|\n| **Full delegation subtree \u002F all descendants of a session** | one-hop `parent_id` walks, edge-type guessing | `apoc.path.expandConfig(root, {relationshipFilter:'FORKED>', minLevel:1, maxLevel:20})`, or `gds.bfs` | one call returns the whole bounded lineage; respects Trap 1 (lineage is `FORKED`, *not* `HAS_SUBSESSION`) |\n| **How are two sessions connected \u002F shortest path** | manual `-[*1..n]->` + filtering | `gds.shortestPath.*` (or `apoc.path.expandConfig`) | correct pathfinding in one pass |\n| **Which agent\u002Fsession is a hub \u002F most influential** | `collect` + `size` degree-counting | `gds.pageRank` \u002F `gds.degree` \u002F `gds.betweenness` over `Session`\u002F`FORKED`, rolled up by the `Session.agent` property | real centrality; see graph-query §8 for the exact projection + agent-rollup (agents are a property to roll up by, **not** a projectable graph) |\n| **Clusters \u002F communities of related sessions** | can't express it naively | `gds.louvain` \u002F `gds.wcc` | community structure in one call |\n| **Sessions similar by shared tools\u002Fskills** | pairwise `collect` intersections | `gds.nodeSimilarity` over a `Session`→`Tool`\u002F`Skill` projection | scalable similarity instead of O(n²) hand-joins |\n| **Reach a JSON field inside `Event.data`** | `e.data.working_dir` (raises a type error) | `apoc.convert.fromJsonMap(e.data).working_dir` | correct *and* lean — see graph-query §8's authoritative pattern |\n| **Operate over a known set of ids** | 50-id `IN [ … ]` literal | pass `$ids` and `UNWIND $ids AS id` | one reusable shape; for heavy scans, `apoc.periodic.iterate` |\n| **Consecutive-pair math (inter-event gaps)** | `UNWIND range(0,size-2)` | `apoc.coll.pairsMin(list)` | expresses the intent directly |\n\n---\n\n## Complex topology searches — the hard ones this skill exists for\n\nThese are the searches naive Cypher either **cannot express** or does at O(n²) with\nwrong\u002Fapproximate results. When the question is one of these, do NOT hand-roll it —\nproject the right graph and run the algorithm.\n\n**1. Centrality \u002F influence** — \"which sessions, agents, or tools are structurally most important?\"\n- `gds.pageRank` · `gds.betweenness` · `gds.degree` · `gds.closeness` · `gds.eigenvector`.\n- Project the relevant graph (`Session`\u002F`FORKED` for delegation influence; a tool\n  co-occurrence graph for tool influence), stream, roll up by the property you care\n  about, `gds.graph.drop`.\n\n**2. Topological \u002F structural similarity** — \"which sessions are shaped alike?\"\n- **By shared neighbors** (same tools\u002Fskills\u002Fagents used): project a **bipartite**\n  `Session → Tool` (or `→Skill`\u002F`→Agent`) graph → `gds.nodeSimilarity` (Jaccard\u002Foverlap)\n  or `gds.knn`.\n- **By structural role** (behave alike even without sharing exact neighbors):\n  `gds.fastRP` (or `gds.node2vec`) node embeddings → `gds.knn` for nearest structural\n  neighbors. This finds role-equivalent sessions.\n- **Weight the vector before you compare it.** Raw tool-usage counts are dominated by glue\n  tools (`bash`, `read_file`, `todo`) — un-weighted, *every* session looks similar and the\n  result is noise. Down-weight ubiquitous tools with a TF-IDF weighting (the same job\n  `fastRP` otherwise buys you), built in-graph with `apoc.map.fromPairs(collect([tool_name, count]))`.\n- **Read-only fallback — no bipartite edges needed.** When the store is read-only and you\n  can't materialise `Session→Tool` edges, compute the weighted vector as a **node property**\n  inside the Cypher projection and run `gds.knn(nodeProperties: ['toolVector'])` directly on\n  it — same answer, no derived edges. (General principle: when an algorithm's naive input is\n  wrong or unavailable, reshape the input in the projection before reaching for a fancier algorithm.)\n\n**3. Similar event PATHS \u002F trajectories — the sequence question, with or without time**\nThis is the \"find similar paths of events\" search. The time dimension decides the tool:\n- **WITHOUT time (bag of steps):** reduce each session to its *multiset* of event\u002Ftool\n  types, then `gds.nodeSimilarity`\u002F`gds.knn` over the `Session → Tool` projection. Order\n  is ignored — \"used A, B, C\" matches \"used C, B, A\".\n- **WITH time (ordered trajectory):** order matters, so build the ordering first. Sort\n  each session's events by `started_at`, form consecutive pairs with\n  `apoc.coll.pairsMin(ordered_list)`, and materialise a **transition signature** —\n  `(:Session)-[:HAS_TRANSITION]->(:TypePair {a,b})`. Then either `gds.nodeSimilarity`\n  over that transition projection, or `gds.fastRP` + `gds.knn` to cluster whole\n  trajectories. This distinguishes `A→B→C` from `A→C→B`, which set-similarity cannot.\n- Extract one session's ordered path with `apoc.path.expandConfig` or a time-ordered\n  `MATCH` — never a client-side reconstruction.\n\n**4. Pathfinding \u002F reachability** — shortest, k-shortest, all-reachable.\n- `gds.shortestPath.dijkstra` · `gds.allShortestPaths` · Yen's k-shortest ·\n  `gds.bfs`\u002F`gds.dfs`; or `apoc.path.expandConfig` for filtered reach.\n\n**Projection recipe (similarity\u002Ftrajectory graphs are not stored edges — build them):**\n```cypher\n\u002F\u002F bipartite Session→ToolCall for similarity (Cypher projection, GDS 2.x)\n\u002F\u002F confirm the Session→ToolCall reach against the graph-query skill \u002F live schema first\nCALL gds.graph.project.cypher('sess-tool',\n  'MATCH (n) WHERE n:Session OR n:ToolCall RETURN id(n) AS id',\n  'MATCH (s:Session)-[:HAS_EXECUTION|HAS_PART*1..3]->(tc:ToolCall)\n   RETURN id(s) AS source, id(tc) AS target');\nCALL gds.nodeSimilarity.stream('sess-tool')\n  YIELD node1, node2, similarity\nRETURN gds.util.asNode(node1).node_id AS a, gds.util.asNode(node2).node_id AS b, similarity\nORDER BY similarity DESC LIMIT 20;\nCALL gds.graph.drop('sess-tool') YIELD graphName;   \u002F\u002F always release (in-memory only, no data touched)\n```\n\n**Deriving a graph that isn't stored (co-occurrence \u002F teaming).** \"Which agents work\ntogether?\" has no stored `Agent→Agent` edge — but you can *derive* one from shared group\nmembership (e.g. agents whose sessions share a parent), then run community\u002Fcentrality on the\nderived graph. This is valid and **different from projecting the real (edge-less) `Agent`\nnodes, which is the dead end** graph-query §8 warns about — confirm the grouping edge against\nthe live schema first:\n```cypher\nCALL gds.graph.project.cypher('agent-team',\n  'MATCH (s:Session) WHERE s.agent IS NOT NULL RETURN id(s) AS id, s.agent AS agent',\n  'MATCH (a:Session)\u003C-[:FORKED]-(p)-[:FORKED]->(b:Session)\n   WHERE a.agent \u003C b.agent RETURN id(a) AS source, id(b) AS target, count(*) AS weight');\nCALL gds.louvain.stream('agent-team') YIELD nodeId, communityId RETURN communityId, count(*) LIMIT 20;\nCALL gds.graph.drop('agent-team') YIELD graphName;\n```\n\n---\n\n## Four primitives that replace most naive Cypher here\n\nDefault to these instead of re-deriving structure:\n\n1. **The lineage walker** — `apoc.path.expandConfig` over `FORKED` (or a `Session`\u002F`FORKED`\n   GDS projection for tree analytics). This one primitive replaces the single largest\n   class of hand-rolled queries on this graph.\n2. **The JSON-lift reflex** — never touch `Event.data` with dot-access; parse in-graph\n   with `apoc.convert.fromJsonMap` and return only the scalar (graph-query §8 is authoritative).\n3. **The parameterized id-set** — `UNWIND $ids`, never a pasted literal list. Collapses a\n   long tail of \"unique\" queries into one reused shape.\n4. **The in-graph frequency map** — `apoc.map.fromPairs(collect([key, count]))` builds a\n   per-node weight\u002Fvector map server-side (feeds TF-IDF `gds.knn` node properties). When\n   collecting a set as a grouping key, canonicalise it first with `apoc.coll.sort` so `[A,B]`\n   and `[B,A]` group as one.\n\n---\n\n## When naive Cypher IS the right tool (don't over-reach)\n\nGDS\u002FAPOC is not always the answer. A **single plain Cypher statement** already wins for:\n\n- counts and existence checks (`RETURN count(*)`),\n- single-session scalar lookups,\n- group-bys \u002F distributions over one hop (`GROUP BY tool_name`),\n- schema probes (`db.labels()`, `db.relationshipTypes()`).\n\nReach for the algorithm when the naive alternative means **many round-trips, a large\nclient-side pull, or reconstructing an algorithm by hand** — not for a plain aggregate.\n\n---\n\n## When GDS itself isn't enough (the upper bound)\n\nGDS answers **structural \u002F behavioral** questions — how a session was executed, who is\ncentral, what clusters by shape. It does **not** answer **intent** questions — what a session\nwas *for*. Tool-vector similarity clusters the *machinery*, not the *mission*. The tell: if you\ncross-tab a GDS cluster against the human's actual objective and the same goal is scattered\nacross most clusters, stop iterating on GDS. Export the bounded inline text (e.g.\n`Prompt.prompt`) and run LLM-embedding + k-means instead — a different tool for a different\nquestion shape. Escalating *to* GDS is right; escalating *past* it when the question is\nsemantic is the next move, not more algorithms.\n\n---\n\n## Guardrails\n\n- **Probe first:** `RETURN gds.version()` \u002F `CALL gds.list()`; `CALL apoc.help('path')`.\n  Both plugins run on the live target (Neo4j Community — GDS works).\n- **Always release projections:** `gds.graph.drop('g')` when done.\n- **Behind a read-only-enforcing endpoint, use `.stream` \u002F scalar `.stats`.** The `.write`\u002F\n  `.mutate` variants can be rejected (HTTP 500) even though they only touch the in-memory\n  catalog, not the store.\n- **Bound the returned result** even when the compute is server-side — `count` \u002F aggregate\n  \u002F `LIMIT`. Pushing work to the DB does not excuse an unbounded `RETURN`.\n- **Project the labels that exist** — `Session` (nodes), `FORKED` (relationships). Agents\n  are a **property** (`Session.agent`) to roll up by, not a projectable graph.\n- **Honor the schema traps** — especially Trap 1 (delegation lineage is `FORKED` +\n  `Session.parent_id`, and `HAS_SUBSESSION` is a single hop). The graph-query skill owns\n  these; load it before writing the query.\n","# Context Intelligence — Graph Data Science First\n\nThe context-intelligence graph is large (millions of nodes across thousands of\nsessions). Naive Cypher tends to **re-derive, one hop and one round-trip at a time,\nwhat a graph algorithm computes in a single server-side pass**. This skill trains the\nreflex: recognize the *shape* of the question, and when it is a graph-algorithm shape,\nreach for **GDS or APOC** instead of improvising Cypher.\n\n> **This skill is WHEN and WHY. The HOW lives next door.** The graph-query skill owns\n> the schema meaning, the traps, and the worked projection queries — its **Section 8,\n> \"Push Work to the Database (APOC \u002F GDS)\"** has the concrete `gds.graph.project →\n> algorithm → gds.graph.drop` lifecycle and the `Session`\u002F`FORKED` + agent-rollup\n> example. Load `context-intelligence-graph-query` for mechanics; use this skill to\n> decide *whether the algorithm is the right tool at all.*\n\n---\n\n## The naive-query smell test\n\nYou are probably about to write naive Cypher where GDS\u002FAPOC would be better if you catch\nyourself doing any of these:\n\n- **Guessing edge types to walk a tree** (`-[:HAS_SUBSESSION|FORKED|HAS_FORK]->`) or\n  repeatedly stepping `Session.parent_id` one hop at a time to rebuild a delegation tree.\n- **`collect()` then `size([x IN … WHERE …])`** to count how many things are reachable \u002F\n  match — reconstructing an algorithm's output by hand.\n- **A giant `WHERE node_id IN [ …50 literals… ]`** pasted into the query text (client-side\n  set-building shoved into Cypher).\n- **`UNWIND range(0, size(list)-2)`** to compute consecutive gaps \u002F pairwise math.\n- **Variable-length `-[*1..n]->`** followed by client-side filtering of the paths.\n- Pulling many rows to the client to **iterate and aggregate** what the DB could reduce.\n\nEach of these is a tell that the question has a *graph-algorithm shape*.\n\n---\n\n## What the graph-data-science package buys you (the advantages)\n\n| Advantage | Naive Cypher | GDS \u002F APOC |\n|---|---|---|\n| **One pass, not many round-trips** | N queries + client stitching | project once, compute server-side, return a bounded result |\n| **Scales to the whole graph** | degrades \u002F times out on deep or wide traversals | algorithms are built for millions of nodes |\n| **Correct, not approximate** | hand-rolled shortest-path \u002F \"influence\" is easy to get subtly wrong | `gds.shortestPath`, `gds.pageRank`, `gds.betweenness` are the real thing |\n| **Less context churn** | large client-side pulls flood the session | the payload never crosses the wire; only the answer does |\n| **Stable, reusable shapes** | every question becomes a new bespoke query | a handful of parameterized primitives cover most questions |\n\n---\n\n## Best-fit scenarios → the right tool\n\nMatch the *question shape* to the tool. This is the core of the skill.\n\n| The question is really… | Naive trap | Reach for | Why it wins |\n|---|---|---|---|\n| **Full delegation subtree \u002F all descendants of a session** | one-hop `parent_id` walks, edge-type guessing | `apoc.path.expandConfig(root, {relationshipFilter:'FORKED>', minLevel:1, maxLevel:20})`, or `gds.bfs` | one call returns the whole bounded lineage; respects Trap 1 (lineage is `FORKED`, *not* `HAS_SUBSESSION`) |\n| **How are two sessions connected \u002F shortest path** | manual `-[*1..n]->` + filtering | `gds.shortestPath.*` (or `apoc.path.expandConfig`) | correct pathfinding in one pass |\n| **Which agent\u002Fsession is a hub \u002F most influential** | `collect` + `size` degree-counting | `gds.pageRank` \u002F `gds.degree` \u002F `gds.betweenness` over `Session`\u002F`FORKED`, rolled up by the `Session.agent` property | real centrality; see graph-query §8 for the exact projection + agent-rollup (agents are a property to roll up by, **not** a projectable graph) |\n| **Clusters \u002F communities of related sessions** | can't express it naively | `gds.louvain` \u002F `gds.wcc` | community structure in one call |\n| **Sessions similar by shared tools\u002Fskills** | pairwise `collect` intersections | `gds.nodeSimilarity` over a `Session`→`Tool`\u002F`Skill` projection | scalable similarity instead of O(n²) hand-joins |\n| **Reach a JSON field inside `Event.data`** | `e.data.working_dir` (raises a type error) | `apoc.convert.fromJsonMap(e.data).working_dir` | correct *and* lean — see graph-query §8's authoritative pattern |\n| **Operate over a known set of ids** | 50-id `IN [ … ]` literal | pass `$ids` and `UNWIND $ids AS id` | one reusable shape; for heavy scans, `apoc.periodic.iterate` |\n| **Consecutive-pair math (inter-event gaps)** | `UNWIND range(0,size-2)` | `apoc.coll.pairsMin(list)` | expresses the intent directly |\n\n---\n\n## Complex topology searches — the hard ones this skill exists for\n\nThese are the searches naive Cypher either **cannot express** or does at O(n²) with\nwrong\u002Fapproximate results. When the question is one of these, do NOT hand-roll it —\nproject the right graph and run the algorithm.\n\n**1. Centrality \u002F influence** — \"which sessions, agents, or tools are structurally most important?\"\n- `gds.pageRank` · `gds.betweenness` · `gds.degree` · `gds.closeness` · `gds.eigenvector`.\n- Project the relevant graph (`Session`\u002F`FORKED` for delegation influence; a tool\n  co-occurrence graph for tool influence), stream, roll up by the property you care\n  about, `gds.graph.drop`.\n\n**2. Topological \u002F structural similarity** — \"which sessions are shaped alike?\"\n- **By shared neighbors** (same tools\u002Fskills\u002Fagents used): project a **bipartite**\n  `Session → Tool` (or `→Skill`\u002F`→Agent`) graph → `gds.nodeSimilarity` (Jaccard\u002Foverlap)\n  or `gds.knn`.\n- **By structural role** (behave alike even without sharing exact neighbors):\n  `gds.fastRP` (or `gds.node2vec`) node embeddings → `gds.knn` for nearest structural\n  neighbors. This finds role-equivalent sessions.\n- **Weight the vector before you compare it.** Raw tool-usage counts are dominated by glue\n  tools (`bash`, `read_file`, `todo`) — un-weighted, *every* session looks similar and the\n  result is noise. Down-weight ubiquitous tools with a TF-IDF weighting (the same job\n  `fastRP` otherwise buys you), built in-graph with `apoc.map.fromPairs(collect([tool_name, count]))`.\n- **Read-only fallback — no bipartite edges needed.** When the store is read-only and you\n  can't materialise `Session→Tool` edges, compute the weighted vector as a **node property**\n  inside the Cypher projection and run `gds.knn(nodeProperties: ['toolVector'])` directly on\n  it — same answer, no derived edges. (General principle: when an algorithm's naive input is\n  wrong or unavailable, reshape the input in the projection before reaching for a fancier algorithm.)\n\n**3. Similar event PATHS \u002F trajectories — the sequence question, with or without time**\nThis is the \"find similar paths of events\" search. The time dimension decides the tool:\n- **WITHOUT time (bag of steps):** reduce each session to its *multiset* of event\u002Ftool\n  types, then `gds.nodeSimilarity`\u002F`gds.knn` over the `Session → Tool` projection. Order\n  is ignored — \"used A, B, C\" matches \"used C, B, A\".\n- **WITH time (ordered trajectory):** order matters, so build the ordering first. Sort\n  each session's events by `started_at`, form consecutive pairs with\n  `apoc.coll.pairsMin(ordered_list)`, and materialise a **transition signature** —\n  `(:Session)-[:HAS_TRANSITION]->(:TypePair {a,b})`. Then either `gds.nodeSimilarity`\n  over that transition projection, or `gds.fastRP` + `gds.knn` to cluster whole\n  trajectories. This distinguishes `A→B→C` from `A→C→B`, which set-similarity cannot.\n- Extract one session's ordered path with `apoc.path.expandConfig` or a time-ordered\n  `MATCH` — never a client-side reconstruction.\n\n**4. Pathfinding \u002F reachability** — shortest, k-shortest, all-reachable.\n- `gds.shortestPath.dijkstra` · `gds.allShortestPaths` · Yen's k-shortest ·\n  `gds.bfs`\u002F`gds.dfs`; or `apoc.path.expandConfig` for filtered reach.\n\n**Projection recipe (similarity\u002Ftrajectory graphs are not stored edges — build them):**\n```cypher\n\u002F\u002F bipartite Session→ToolCall for similarity (Cypher projection, GDS 2.x)\n\u002F\u002F confirm the Session→ToolCall reach against the graph-query skill \u002F live schema first\nCALL gds.graph.project.cypher('sess-tool',\n  'MATCH (n) WHERE n:Session OR n:ToolCall RETURN id(n) AS id',\n  'MATCH (s:Session)-[:HAS_EXECUTION|HAS_PART*1..3]->(tc:ToolCall)\n   RETURN id(s) AS source, id(tc) AS target');\nCALL gds.nodeSimilarity.stream('sess-tool')\n  YIELD node1, node2, similarity\nRETURN gds.util.asNode(node1).node_id AS a, gds.util.asNode(node2).node_id AS b, similarity\nORDER BY similarity DESC LIMIT 20;\nCALL gds.graph.drop('sess-tool') YIELD graphName;   \u002F\u002F always release (in-memory only, no data touched)\n```\n\n**Deriving a graph that isn't stored (co-occurrence \u002F teaming).** \"Which agents work\ntogether?\" has no stored `Agent→Agent` edge — but you can *derive* one from shared group\nmembership (e.g. agents whose sessions share a parent), then run community\u002Fcentrality on the\nderived graph. This is valid and **different from projecting the real (edge-less) `Agent`\nnodes, which is the dead end** graph-query §8 warns about — confirm the grouping edge against\nthe live schema first:\n```cypher\nCALL gds.graph.project.cypher('agent-team',\n  'MATCH (s:Session) WHERE s.agent IS NOT NULL RETURN id(s) AS id, s.agent AS agent',\n  'MATCH (a:Session)\u003C-[:FORKED]-(p)-[:FORKED]->(b:Session)\n   WHERE a.agent \u003C b.agent RETURN id(a) AS source, id(b) AS target, count(*) AS weight');\nCALL gds.louvain.stream('agent-team') YIELD nodeId, communityId RETURN communityId, count(*) LIMIT 20;\nCALL gds.graph.drop('agent-team') YIELD graphName;\n```\n\n---\n\n## Four primitives that replace most naive Cypher here\n\nDefault to these instead of re-deriving structure:\n\n1. **The lineage walker** — `apoc.path.expandConfig` over `FORKED` (or a `Session`\u002F`FORKED`\n   GDS projection for tree analytics). This one primitive replaces the single largest\n   class of hand-rolled queries on this graph.\n2. **The JSON-lift reflex** — never touch `Event.data` with dot-access; parse in-graph\n   with `apoc.convert.fromJsonMap` and return only the scalar (graph-query §8 is authoritative).\n3. **The parameterized id-set** — `UNWIND $ids`, never a pasted literal list. Collapses a\n   long tail of \"unique\" queries into one reused shape.\n4. **The in-graph frequency map** — `apoc.map.fromPairs(collect([key, count]))` builds a\n   per-node weight\u002Fvector map server-side (feeds TF-IDF `gds.knn` node properties). When\n   collecting a set as a grouping key, canonicalise it first with `apoc.coll.sort` so `[A,B]`\n   and `[B,A]` group as one.\n\n---\n\n## When naive Cypher IS the right tool (don't over-reach)\n\nGDS\u002FAPOC is not always the answer. A **single plain Cypher statement** already wins for:\n\n- counts and existence checks (`RETURN count(*)`),\n- single-session scalar lookups,\n- group-bys \u002F distributions over one hop (`GROUP BY tool_name`),\n- schema probes (`db.labels()`, `db.relationshipTypes()`).\n\nReach for the algorithm when the naive alternative means **many round-trips, a large\nclient-side pull, or reconstructing an algorithm by hand** — not for a plain aggregate.\n\n---\n\n## When GDS itself isn't enough (the upper bound)\n\nGDS answers **structural \u002F behavioral** questions — how a session was executed, who is\ncentral, what clusters by shape. It does **not** answer **intent** questions — what a session\nwas *for*. Tool-vector similarity clusters the *machinery*, not the *mission*. The tell: if you\ncross-tab a GDS cluster against the human's actual objective and the same goal is scattered\nacross most clusters, stop iterating on GDS. Export the bounded inline text (e.g.\n`Prompt.prompt`) and run LLM-embedding + k-means instead — a different tool for a different\nquestion shape. Escalating *to* GDS is right; escalating *past* it when the question is\nsemantic is the next move, not more algorithms.\n\n---\n\n## Guardrails\n\n- **Probe first:** `RETURN gds.version()` \u002F `CALL gds.list()`; `CALL apoc.help('path')`.\n  Both plugins run on the live target (Neo4j Community — GDS works).\n- **Always release projections:** `gds.graph.drop('g')` when done.\n- **Behind a read-only-enforcing endpoint, use `.stream` \u002F scalar `.stats`.** The `.write`\u002F\n  `.mutate` variants can be rejected (HTTP 500) even though they only touch the in-memory\n  catalog, not the store.\n- **Bound the returned result** even when the compute is server-side — `count` \u002F aggregate\n  \u002F `LIMIT`. Pushing work to the DB does not excuse an unbounded `RETURN`.\n- **Project the labels that exist** — `Session` (nodes), `FORKED` (relationships). Agents\n  are a **property** (`Session.agent`) to roll up by, not a projectable graph.\n- **Honor the schema traps** — especially Trap 1 (delegation lineage is `FORKED` +\n  `Session.parent_id`, and `HAS_SUBSESSION` is a single hop). The graph-query skill owns\n  these; load it before writing the query.\n",{"name":5,"license":16,"metadata":37,"description":43},{"version":38,"changelog":39},"1.2.0",[40,41,42],"1.2.0: Lifted patterns from a real graph exploration — TF-IDF weighting to defeat glue-tool dominance in similarity; read-only vector-property gds.knn fallback (no bipartite edges); a derived co-occurrence\u002Fteaming projection (distinct from the edge-less Agent-node dead end); apoc.map.fromPairs\u002Fapoc.coll.sort as a fourth primitive (in-graph frequency map); a read-only .stream\u002F.stats vs .write\u002F.mutate guardrail; and a 'When GDS itself isn't enough' boundary (structure vs intent → escalate to LLM embeddings).","1.1.0: Added the 'Complex topology searches' section — centrality, topological\u002Fstructural similarity (nodeSimilarity\u002FKNN\u002FFastRP embeddings), and similar event PATHS \u002F trajectories with-or-without a time dimension (set-similarity vs transition-signature), plus pathfinding and a non-lineage projection recipe. These are the hard searches the skill exists to route off naive Cypher.","1.0.0: Initial — GDS\u002FAPOC scenario-selection and advantages, avoid-naive-Cypher decision map, three reusable primitives tuned to this graph.","Use when about to write naive Cypher for a graph-topology question — pathfinding, reachability, centrality\u002Finfluence, community\u002Fclustering, structural similarity, or similar event paths\u002Ftrajectories (with\u002Fwithout time) — reach for Neo4j GDS or APOC instead of hand-rolling traversals one hop at a time. WHEN\u002FWHY layer; graph-query's \"Push Work to the Database\" section is the HOW.\n","main","2a8d7bd1e022971c395ec38ed797bf75fcf7aff7","skills\u002Fcontext-intelligence-gds",7,"https:\u002F\u002Fgithub.com\u002Fmicrosoft\u002Famplifier-bundle-context-intelligence","https:\u002F\u002Fgithub.com\u002Fmicrosoft","https:\u002F\u002Fopensource.microsoft.com","Open source projects and samples from Microsoft","2026-11-15 02:34:45",{"source":9,"skillName":5,"commands":54,"prompt":64,"zipAvailable":65},[55,58,61],{"tool":56,"command":57},"npx","npx skills add microsoft\u002Famplifier-bundle-context-intelligence --skill context-intelligence-gds",{"tool":59,"command":60},"bunx","bunx skills add microsoft\u002Famplifier-bundle-context-intelligence --skill context-intelligence-gds",{"tool":62,"command":63},"pnpm","pnpm dlx skills add microsoft\u002Famplifier-bundle-context-intelligence --skill context-intelligence-gds","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fmicrosoft\u002Famplifier-bundle-context-intelligence\u002Fblob\u002Fmain\u002Fskills\u002Fcontext-intelligence-gds\u002FSKILL.md",true,[],[68,88,105,122,138,150],{"skillNo":69,"name":70,"nameZh":71,"description":72,"descriptionZh":73,"repositoryFullName":9,"ownerLogin":10,"ownerAvatarUrl":11,"ownerAccountNo":12,"ownerDisplayName":13,"repositoryNo":14,"starsCount":15,"licenseSpdxId":16,"licenseFileUrl":17,"sourceHtmlUrl":74,"categories":75,"keywords":82,"publishedAt":32},"01M69BGZVPJBKSZV5N0WMVGR3N","workflow-pattern-analysis","工作流失败模式分析","Use when asked how a workflow is failing, what separates a successful run from a failing one, which steps are the most common failure points, or what patterns recur across sessions — analyses failure\u002Fsuccess patterns and signals across many runs using context-intelligence session data.","当用户询问工作流为何失败、成功运行与失败运行有何区别、哪些步骤是最常见的失败点，或哪些模式会在多个会话中反复出现时使用——基于 context-intelligence 会话数据，分析大量运行中的失败\u002F成功模式与信号。","https:\u002F\u002Fgithub.com\u002Fmicrosoft\u002Famplifier-bundle-context-intelligence\u002Fblob\u002Fmain\u002Fskills\u002Fworkflow-pattern-analysis\u002FSKILL.md",[76,79],{"categoryNo":77,"categoryName":78,"taxonomyType":23,"taxonomyTypeDesc":24},"01M8BQGD4WETX0HM3SM9QKQ15B","SRE 工程师",{"categoryNo":80,"categoryName":81,"taxonomyType":28,"taxonomyTypeDesc":29},"01M8BRSRYQ3M8N5063NNQPF2B1","调试与故障排查",[83,84,85,86,87],"workflow pattern analysis","workflow","reasoning","run","sessions",{"skillNo":89,"name":90,"nameZh":91,"description":92,"descriptionZh":93,"repositoryFullName":9,"ownerLogin":10,"ownerAvatarUrl":11,"ownerAccountNo":12,"ownerDisplayName":13,"repositoryNo":14,"starsCount":15,"licenseSpdxId":16,"licenseFileUrl":17,"sourceHtmlUrl":94,"categories":95,"keywords":102,"publishedAt":32},"01M69BGYAYC16BRSB0EGMCKMF5","transcript","会话记录检索与回放","Retrieve the prior user and assistant conversation verbatim from the current Context Intelligence capture, or named sessions. Use when a user asks to replay, quote, review, or act on a transcript.","从当前 Context Intelligence 捕获内容或指定的命名会话中，逐字检索此前用户与助手的对话。当用户要求回放、引用、审阅对话记录，或基于对话记录执行操作时使用。","https:\u002F\u002Fgithub.com\u002Fmicrosoft\u002Famplifier-bundle-context-intelligence\u002Fblob\u002Fmain\u002Fskills\u002Ftranscript\u002FSKILL.md",[96,99],{"categoryNo":97,"categoryName":98,"taxonomyType":23,"taxonomyTypeDesc":24},"01M8BQ6TRAEZFJ43R95HPEBJYG","知识工作者",{"categoryNo":100,"categoryName":101,"taxonomyType":28,"taxonomyTypeDesc":29},"01M8BTBRVQZ06FQWD8P64214B2","会话上下文交接",[90,103,104,87],"review","assistant",{"skillNo":106,"name":107,"nameZh":108,"description":109,"descriptionZh":110,"repositoryFullName":9,"ownerLogin":10,"ownerAvatarUrl":11,"ownerAccountNo":12,"ownerDisplayName":13,"repositoryNo":14,"starsCount":15,"licenseSpdxId":16,"licenseFileUrl":17,"sourceHtmlUrl":111,"categories":112,"keywords":119,"publishedAt":32},"01M69BGWQGCEN13DHHAQGTQ609","context-intelligence-tool-design","信号检测策略设计","Use when selecting a detection strategy and implementation primitive for a context-intelligence signal. Classifies signals as deterministic, probabilistic, llm-evaluated, or hybrid, and applies the cheapest-sufficient-capability principle.","在为 context-intelligence 信号选择检测策略和实现原语时使用。将信号分类为确定性、概率性、LLM 评估或混合型，并应用「最经济且足够」的能力原则（cheapest-sufficient-capability）。","https:\u002F\u002Fgithub.com\u002Fmicrosoft\u002Famplifier-bundle-context-intelligence\u002Fblob\u002Fmain\u002Fskills\u002Fcontext-intelligence-tool-design\u002FSKILL.md",[113,116],{"categoryNo":114,"categoryName":115,"taxonomyType":23,"taxonomyTypeDesc":24},"01M8BRZZF9D7PVFN5MXSPWWD61","AI 工程师",{"categoryNo":117,"categoryName":118,"taxonomyType":28,"taxonomyTypeDesc":29},"01M8BSAA4FBTWZP6X98STEHG99","智能体开发",[120,121,85],"design","context intelligence tool design",{"skillNo":123,"name":124,"nameZh":125,"description":126,"descriptionZh":127,"repositoryFullName":9,"ownerLogin":10,"ownerAvatarUrl":11,"ownerAccountNo":12,"ownerDisplayName":13,"repositoryNo":14,"starsCount":15,"licenseSpdxId":16,"licenseFileUrl":17,"sourceHtmlUrl":128,"categories":129,"keywords":136,"publishedAt":32},"01M69BGVHJJFCNZMGM21FNWMFS","context-intelligence-session-reconstruction","会话文件重建与修复","Use when local Amplifier session files are missing, broken, or incomplete — rebuilds events.jsonl, transcript.jsonl, and metadata.json from the context-intelligence graph server.","当本地 Amplifier 会话文件丢失、损坏或不完整时使用——从 context-intelligence 图服务器重建 events.jsonl、transcript.jsonl 和 metadata.json。","https:\u002F\u002Fgithub.com\u002Fmicrosoft\u002Famplifier-bundle-context-intelligence\u002Fblob\u002Fmain\u002Fskills\u002Fcontext-intelligence-session-reconstruction\u002FSKILL.md",[130,133],{"categoryNo":131,"categoryName":132,"taxonomyType":23,"taxonomyTypeDesc":24},"01M8BQ6TQZN6R52WBJ9H8NRMQM","软件开发工程师",{"categoryNo":134,"categoryName":135,"taxonomyType":28,"taxonomyTypeDesc":29},"01M8BSSTY86MWS6W5GDQWB1ADQ","备份与灾难恢复",[137],"context intelligence session reconstruction",{"skillNo":139,"name":140,"nameZh":141,"description":142,"descriptionZh":143,"repositoryFullName":9,"ownerLogin":10,"ownerAvatarUrl":11,"ownerAccountNo":12,"ownerDisplayName":13,"repositoryNo":14,"starsCount":15,"licenseSpdxId":16,"licenseFileUrl":17,"sourceHtmlUrl":144,"categories":145,"keywords":148,"publishedAt":32},"01M69BGT14VQD1M3P12WZGTQCS","context-intelligence-session-navigation","本地会话检索与事件检查","Use for workspace-scoped local session discovery and event, tool, error, or capture inspection in JSONL files, independent of graph availability.","用于工作区范围内的本地会话发现，以及对 JSONL 文件中的事件、工具、错误或捕获内容的检查，不依赖图服务的可用性。","https:\u002F\u002Fgithub.com\u002Fmicrosoft\u002Famplifier-bundle-context-intelligence\u002Fblob\u002Fmain\u002Fskills\u002Fcontext-intelligence-session-navigation\u002FSKILL.md",[146,147],{"categoryNo":131,"categoryName":132,"taxonomyType":23,"taxonomyTypeDesc":24},{"categoryNo":80,"categoryName":81,"taxonomyType":28,"taxonomyTypeDesc":29},[149],"context intelligence session navigation",{"skillNo":151,"name":152,"nameZh":153,"description":154,"descriptionZh":155,"repositoryFullName":9,"ownerLogin":10,"ownerAvatarUrl":11,"ownerAccountNo":12,"ownerDisplayName":13,"repositoryNo":14,"starsCount":15,"licenseSpdxId":16,"licenseFileUrl":17,"sourceHtmlUrl":156,"categories":157,"keywords":162,"publishedAt":32},"01M69BGRET24BR6PTYANVE57F4","context-intelligence-server-data-ops","会话数据删除与清理","Exact step order, wording, and the \"session details\" block format for the delete flows the server-data-ops agent drives — delete the current session, clean up every session from the current working directory, find-then-delete a session by description, and delete a session someone else created.","为 server-data-ops agent 所驱动的删除流程提供精确的步骤顺序、措辞以及「session details」块格式——包括删除当前会话、清理当前工作目录中的所有会话、按描述查找并删除某个会话，以及删除他人创建的会话。","https:\u002F\u002Fgithub.com\u002Fmicrosoft\u002Famplifier-bundle-context-intelligence\u002Fblob\u002Fmain\u002Fskills\u002Fcontext-intelligence-server-data-ops\u002FSKILL.md",[158,159],{"categoryNo":131,"categoryName":132,"taxonomyType":23,"taxonomyTypeDesc":24},{"categoryNo":160,"categoryName":161,"taxonomyType":28,"taxonomyTypeDesc":29},"01M8BS1P4QM1G70C9FKMTZ88VK","数据库管理",[163,164,165],"context intelligence server data ops","directory","delete"]