@niroai/niro 0.17.0 → 0.18.0

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.
Files changed (177) hide show
  1. package/CHANGELOG.md +136 -0
  2. package/README.md +123 -302
  3. package/bin/niro.js +12 -1
  4. package/docs/agent-antigravity.md +37 -0
  5. package/docs/agent-claude-code.md +48 -0
  6. package/docs/agent-claude-desktop.md +47 -0
  7. package/docs/agent-cline.md +42 -0
  8. package/docs/agent-codex.md +45 -0
  9. package/docs/agent-copilot-cli.md +42 -0
  10. package/docs/agent-cursor.md +44 -0
  11. package/docs/agent-factory.md +42 -0
  12. package/docs/agent-gemini-cli.md +42 -0
  13. package/docs/agent-goose.md +42 -0
  14. package/docs/agent-kiro.md +37 -0
  15. package/docs/agent-opencode.md +37 -0
  16. package/docs/agent-vscode.md +45 -0
  17. package/docs/agent-windsurf.md +38 -0
  18. package/docs/answer-shapes.md +69 -0
  19. package/docs/builds-and-updates.md +68 -0
  20. package/docs/cloud-README.md +372 -0
  21. package/docs/configuring-a-folder.md +51 -0
  22. package/docs/connect-ci.md +24 -0
  23. package/docs/connect-overview.md +20 -0
  24. package/docs/connect-review-bots.md +17 -0
  25. package/docs/connect-team-server.md +12 -0
  26. package/docs/connect-terminal.md +49 -0
  27. package/docs/connect-web-agents.md +9 -0
  28. package/docs/connect-your-ai-assistant.md +59 -175
  29. package/docs/coverage-audit-and-consent.md +51 -0
  30. package/docs/evaluate-what-niro-did.md +271 -0
  31. package/docs/faq-assistants-and-mcp.md +122 -0
  32. package/docs/faq-feedback-and-receipts.md +33 -0
  33. package/docs/faq-indexing.md +127 -0
  34. package/docs/faq-install-and-setup.md +103 -0
  35. package/docs/faq-licence-and-plans.md +86 -0
  36. package/docs/faq-login-and-account.md +69 -0
  37. package/docs/faq-offline.md +34 -0
  38. package/docs/faq-performance.md +33 -0
  39. package/docs/faq-privacy-and-security.md +113 -0
  40. package/docs/faq-uninstall.md +47 -0
  41. package/docs/faq-updates.md +59 -0
  42. package/docs/faq-worktrees-and-branches.md +59 -0
  43. package/docs/faq-wrong-or-missing-answers.md +275 -0
  44. package/docs/hosted-only.md +33 -0
  45. package/docs/how-the-graph-works.md +47 -0
  46. package/docs/index.md +157 -0
  47. package/docs/licence-and-plans.md +72 -0
  48. package/docs/lifecycle-debug.md +48 -0
  49. package/docs/lifecycle-onboarding.md +32 -0
  50. package/docs/lifecycle-overview.md +77 -0
  51. package/docs/lifecycle-plan-and-design.md +44 -0
  52. package/docs/lifecycle-review.md +30 -0
  53. package/docs/lifecycle-security-and-privacy.md +35 -0
  54. package/docs/lifecycle-test.md +28 -0
  55. package/docs/lifecycle-write-code.md +35 -0
  56. package/docs/llms-full.txt +8015 -0
  57. package/docs/llms.txt +126 -0
  58. package/docs/playbook-add-a-feature.md +108 -0
  59. package/docs/playbook-change-safely.md +93 -0
  60. package/docs/playbook-data-and-events.md +107 -0
  61. package/docs/playbook-debug-after-a-change.md +96 -0
  62. package/docs/playbook-debug-config.md +95 -0
  63. package/docs/playbook-debug-exception.md +124 -0
  64. package/docs/playbook-debug-failing-service-call.md +119 -0
  65. package/docs/playbook-debug-slow-path.md +80 -0
  66. package/docs/playbook-debug-wrong-value.md +137 -0
  67. package/docs/playbook-onboard.md +95 -0
  68. package/docs/playbook-review-a-change.md +72 -0
  69. package/docs/playbook-test-a-change.md +73 -0
  70. package/docs/reference-cli.md +113 -0
  71. package/docs/reference-config-files.md +42 -0
  72. package/docs/reference-engine-commands.md +56 -0
  73. package/docs/reference-environment-variables.md +89 -0
  74. package/docs/reference-exit-codes.md +67 -0
  75. package/docs/reference-limits.md +75 -0
  76. package/docs/reference-mcp-tools.md +326 -0
  77. package/docs/reference-messages.md +180 -0
  78. package/docs/secrets-and-masking.md +48 -0
  79. package/docs/supported-c.md +130 -0
  80. package/docs/supported-cpp.md +157 -0
  81. package/docs/supported-csharp.md +211 -0
  82. package/docs/supported-go.md +258 -0
  83. package/docs/supported-java.md +226 -0
  84. package/docs/supported-javascript.md +223 -0
  85. package/docs/supported-kotlin.md +124 -0
  86. package/docs/supported-overview.md +89 -0
  87. package/docs/supported-php.md +157 -0
  88. package/docs/supported-python.md +224 -0
  89. package/docs/supported-ruby.md +162 -0
  90. package/docs/supported-rust.md +150 -0
  91. package/docs/supported-swift.md +133 -0
  92. package/docs/supported-typescript.md +220 -0
  93. package/docs/tokens-speed-and-accuracy.md +99 -0
  94. package/docs/troubleshooting.md +42 -0
  95. package/docs/uninstall.md +74 -0
  96. package/docs/what-leaves-your-machine.md +71 -0
  97. package/docs/where-things-are-stored.md +59 -0
  98. package/docs/worktrees-and-branches.md +55 -0
  99. package/package.json +5 -3
  100. package/src/commands/add-repo.js +5 -0
  101. package/src/commands/auditSend.js +67 -0
  102. package/src/commands/build.js +6 -0
  103. package/src/commands/docsSend.js +73 -0
  104. package/src/commands/engine.js +120 -0
  105. package/src/commands/engineRoutes.js +105 -0
  106. package/src/commands/guide.js +254 -0
  107. package/src/commands/init.js +6 -2
  108. package/src/commands/initLocal.js +96 -0
  109. package/src/commands/journalSend.js +47 -0
  110. package/src/commands/login.js +89 -12
  111. package/src/commands/mcp.js +22 -6
  112. package/src/commands/plan.js +99 -0
  113. package/src/commands/repoPush.js +33 -0
  114. package/src/commands/requestIntegration.js +38 -0
  115. package/src/commands/share.js +56 -0
  116. package/src/commands/start.js +451 -371
  117. package/src/commands/status.js +57 -0
  118. package/src/commands/takeover.js +6 -0
  119. package/src/commands/uninstall.js +180 -0
  120. package/src/commands/upgrade.js +38 -8
  121. package/src/commands/watch.js +420 -6
  122. package/src/index.js +174 -3
  123. package/src/lib/agentApi.js +32 -1
  124. package/src/lib/api.js +20 -6
  125. package/src/lib/auditUpload.js +293 -0
  126. package/src/lib/branchDrift.js +149 -0
  127. package/src/lib/choose.js +116 -0
  128. package/src/lib/cloudGuard.js +74 -0
  129. package/src/lib/credentials.js +2 -2
  130. package/src/lib/docsMarked.js +55 -0
  131. package/src/lib/docsState.js +213 -0
  132. package/src/lib/docsUpload.js +481 -0
  133. package/src/lib/engine.js +619 -0
  134. package/src/lib/folderSync.js +2 -1
  135. package/src/lib/graphCheck.js +40 -0
  136. package/src/lib/guide.js +293 -0
  137. package/src/lib/guideSearch.js +252 -0
  138. package/src/lib/integrationRequest.js +89 -0
  139. package/src/lib/journalUpload.js +147 -0
  140. package/src/lib/languages.js +129 -0
  141. package/src/lib/lease.js +375 -0
  142. package/src/lib/localBuild.js +285 -0
  143. package/src/lib/localEngine.js +210 -0
  144. package/src/lib/localOnboard.js +124 -0
  145. package/src/lib/localWorktrees.js +243 -0
  146. package/src/lib/machineCheck.js +58 -0
  147. package/src/lib/mcpClients.js +10 -1
  148. package/src/lib/migrationNotice.js +118 -0
  149. package/src/lib/modelFetch.js +153 -0
  150. package/src/lib/nestedOutput.js +23 -9
  151. package/src/lib/onboardingLog.js +34 -0
  152. package/src/lib/planUsage.js +165 -0
  153. package/src/lib/progressBar.js +46 -0
  154. package/src/lib/prompt.js +1 -1
  155. package/src/lib/redact.js +155 -0
  156. package/src/lib/release.js +33 -0
  157. package/src/lib/repoPush.js +495 -0
  158. package/src/lib/secret.js +1 -1
  159. package/src/lib/service.js +372 -63
  160. package/src/lib/shareCode.js +367 -0
  161. package/src/lib/shareExclusions.js +114 -0
  162. package/src/lib/shareFiles.js +129 -0
  163. package/src/lib/spinner.js +9 -5
  164. package/src/lib/watchDaemon.js +33 -10
  165. package/src/lib/watchState.js +12 -1
  166. package/src/lib/windowsPaths.js +67 -0
  167. package/src/mcp/lineCheck.js +382 -0
  168. package/src/mcp/lineName.js +92 -0
  169. package/src/mcp/localBackend.js +751 -0
  170. package/src/mcp/localMode.js +383 -0
  171. package/src/mcp/localSkill.js +189 -0
  172. package/src/mcp/server.js +610 -79
  173. package/src/mcp/setup.js +519 -131
  174. package/src/mcp/shellSearchHook.js +509 -0
  175. package/src/mcp/teardown.js +173 -91
  176. package/src/mcp/usingNiro.js +39 -0
  177. package/docs/working-on-branches.md +0 -162
@@ -0,0 +1,32 @@
1
+ # Learn a codebase with Niro
2
+
3
+ **When you are new to a codebase, Niro gives you its shape before you read any file.** It shows the services, how they call each other, the routes they serve, the data they keep and the events they send.
4
+
5
+ ## See it in a browser
6
+
7
+ ```
8
+ niro ui
9
+ ```
10
+
11
+ This opens a page that draws the graph. It runs on your computer only (at the address 127.0.0.1, on port 8601 by default), it is read-only, and it stops when you press Ctrl-C.
12
+ <!-- source: src/commands/engineRoutes.js:29; niro-local src/niro_local/ui/server.py:35-36 -->
13
+
14
+ ## Ask in the terminal, or let your agent ask
15
+
16
+ | Question | Tool, or command |
17
+ |---|---|
18
+ | Which service calls which? | `get_service_topology` |
19
+ | Which routes does this code serve? | `find_api_endpoints` |
20
+ | Which other services does it call? | `find_outbound_http_calls` |
21
+ | Which tables and stores does it use? | `list_data_resources`, then `get_data_resource_usage` |
22
+ | Which events does it send and handle? | `list_events`, `find_orphaned_events` |
23
+ | Which classes exist? | `list_types` |
24
+ | Which folders are separate services? | `niro modules` |
25
+ <!-- source: niro-local src/niro_local/mcp/server.py:1860, :1731, :1837, :1920, :1932, :1790, :1825, :1719; src/commands/engineRoutes.js:34 (modules) -->
26
+
27
+ If services are linked wrongly or not at all, you can tell Niro where they live. See [configuring-a-folder.md](configuring-a-folder.md).
28
+
29
+ ## Playbook
30
+
31
+ [Learn a new codebase](playbook-onboard.md) walks the first six questions on Keycloak and on a synthetic monorepo of 68 services.
32
+ <!-- source: docs/playbook-onboard.md -->
@@ -0,0 +1,77 @@
1
+ # Where Niro fits in how you build software
2
+
3
+ **Niro is a ground truth layer.** Ground truth means facts read from the code itself, not from memory or guesses. Before a person or an agent changes code, reviews it, tests it or debugs it, they can check it against a map built from the code as it is now. The map says who calls what, which routes exist, which services talk to each other, and which tables and events are touched.
4
+
5
+ **An everyday comparison:** a builder checks the plans of the building before knocking down a wall, to see which pipes run through it. Niro is the plan of your code, and it is redrawn as the code changes.
6
+ <!-- source: src/lib/localBuild.js:16-46 (the background watcher rebuilds a folder after it changes) -->
7
+
8
+ **Why it matters for an agent:** an agent that builds a list of callers from a text search is usually close and sometimes wrong (measured: in one of our Keycloak A/B sets, every fact the shell-only agent missed was a class reached through an interface). That a wrong list then leads to a wrong edit and a second round of work is reasoning, not measured. Niro's lists say whether they are complete, and why not when they are not. How that pays off over a session is in [tokens-speed-and-accuracy.md](tokens-speed-and-accuracy.md).
9
+ <!-- source: docs/how-the-graph-works.md ("How to read an answer": confidence, has_more); scratchpad niro-local-receipt-recheck/NATIVE-CHOICES.md (21 c4 misses, all implementations behind an interface) -->
10
+
11
+ ## What people actually ask
12
+
13
+ These shares come from 794 recorded Niro calls in agent sessions over 14 days, each labelled by task. **Three limits:** the sessions are mostly Niro's own development (so debugging is under-represented), hosted and local Niro calls are counted together, and the labels were made by hand by one agent, so treat each share as about plus or minus 10%.
14
+
15
+ | Task | Share of calls | Playbook |
16
+ |---|---|---|
17
+ | Understand how existing code works | 41% | [playbook-onboard.md](playbook-onboard.md) |
18
+ | Change code safely: map callers before an edit | 18% | [playbook-change-safely.md](playbook-change-safely.md) |
19
+ | Add a feature: find what exists, follow its shape | 9% | [playbook-add-a-feature.md](playbook-add-a-feature.md) |
20
+ | Debug a wrong value, a slow path or an exception | 6% | the debugging playbooks below |
21
+ | Find where something is | 4% | [playbook-onboard.md](playbook-onboard.md) |
22
+ | Calls between services | 3% | [playbook-debug-failing-service-call.md](playbook-debug-failing-service-call.md) |
23
+ | Data stores and events | 3% | [playbook-data-and-events.md](playbook-data-and-events.md) |
24
+ | Config and environment | 3% | [playbook-debug-config.md](playbook-debug-config.md) |
25
+ | Testing and review | 2% | [playbook-test-a-change.md](playbook-test-a-change.md), [playbook-review-a-change.md](playbook-review-a-change.md) |
26
+ <!-- source: scratchpad niro-cli-task-playbooks/TASKS.md (calls.jsonl from niro-local-answer-shapes, customer calls removed; 794 code calls labelled by hand by one agent, about plus or minus 10%; the other 11% checked the index or the tools themselves). The recordings are mostly Niro's own development, so debugging is under-represented. -->
27
+
28
+ ## The playbooks
29
+
30
+ Each playbook starts from a question in a user's own words and runs real tool calls on public code: Keycloak, and a synthetic multi-service corpus. It shows the real answers, says why each answer is complete or where it is not, and compares it with grep and file reads.
31
+ <!-- source: the pages listed below, each with its runs cited (niro-local 43cce717, 2026-11-10) -->
32
+
33
+ **Debugging:**
34
+ - [An error message or a stack trace](playbook-debug-exception.md): the thrower, its callers, who catches it.
35
+ - [A wrong value](playbook-debug-wrong-value.md): who writes the table or field, and which event delivered it.
36
+ - [A failing call between services](playbook-debug-failing-service-call.md): the caller, the handler, the address, two services on one route.
37
+ - ["It broke after my change"](playbook-debug-after-a-change.md): what the change reaches, tests first.
38
+ - [Config and environment](playbook-debug-config.md): which settings the code reads, where they are set, calls with no address.
39
+ - [A slow path](playbook-debug-slow-path.md): what a slow method calls, and where it goes to the database.
40
+
41
+ **Building and checking:**
42
+ - [Change code safely](playbook-change-safely.md)
43
+ - [Add a feature](playbook-add-a-feature.md)
44
+ - [Review a change](playbook-review-a-change.md)
45
+ - [Test a change](playbook-test-a-change.md)
46
+ - [Learn a new codebase](playbook-onboard.md)
47
+ - [Data stores and events](playbook-data-and-events.md)
48
+
49
+ ## The stages
50
+
51
+ | Stage | Who | How they reach Niro | What Niro gives them | Page |
52
+ |---|---|---|---|---|
53
+ | Plan and design | A developer, or a planning agent | A coding agent, or `niro ask` in the terminal | What a planned change reaches, in both directions | [lifecycle-plan-and-design.md](lifecycle-plan-and-design.md) |
54
+ | Write code | The coding agent; the developer | 14 coding agents over MCP (the Model Context Protocol, the standard way coding agents call outside tools); `niro ask` | Call chains, callers before an edit, the source of one method | [lifecycle-write-code.md](lifecycle-write-code.md) |
55
+ | Review | A reviewer; a review bot | The reviewer's own agent, or `niro ask`, on the branch | What the change reaches. **Pull request review as a product is hosted Niro only.** | [lifecycle-review.md](lifecycle-review.md) |
56
+ | Test | A developer, QA, a test-writing agent | MCP or `niro ask` | Which callers a change reaches, and which of them are tests | [lifecycle-test.md](lifecycle-test.md) |
57
+ | Debug | A developer, a debugging agent | MCP or `niro ask` | Exceptions, writers of a table, handlers of a route or event, what a method calls. **Root cause analysis from alerts is hosted Niro only.** | [lifecycle-debug.md](lifecycle-debug.md) |
58
+ | Onboarding | A new team member; an agent in a new repository | `niro ui`, `niro ask`, MCP | Services and how they connect, endpoints, data stores, events | [lifecycle-onboarding.md](lifecycle-onboarding.md) |
59
+ | Security and privacy | A security reviewer, an admin | Any of the above | What Niro reads, keeps and sends; every route and every outbound call, for an attack-surface list | [lifecycle-security-and-privacy.md](lifecycle-security-and-privacy.md) |
60
+ <!-- source: src/mcp/setup.js:279-414 (14 agents); src/commands/engineRoutes.js:28-29 (ask, ui) -->
61
+
62
+ ## Four habits that make answers smaller and better
63
+
64
+ 1. **Ask for the shortest form that answers you.** `answer=count` for "how many", `answer=locations` for "where", `answer=names` for "which". See [answer-shapes.md](answer-shapes.md).
65
+ 2. **Use the graph tool for structure, and `code_grep` for text.** Callers, routes, tables and events come from the graph; error messages, setting names and comments come from `code_grep`.
66
+ 3. **Ask the name the callers use.** For a method declared on an interface, ask the interface name the calls are written against. See [faq-wrong-or-missing-answers.md](faq-wrong-or-missing-answers.md).
67
+ 4. **Read the confidence line.** "complete" means use it as it is. "PARTIAL" says what was cut and how to get the rest.
68
+ <!-- source: docs/answer-shapes.md; niro-local server instructions ("Which tool (the most specific wins; one call each)"); docs/how-the-graph-works.md ("How to read an answer") -->
69
+
70
+ ## See what it did for you
71
+
72
+ The line at the end of each task, the record of what was asked, and a do-it-yourself A/B: [evaluate-what-niro-did.md](evaluate-what-niro-did.md).
73
+
74
+ ## What this version does not do
75
+
76
+ This version of niro-cli answers everything from the graph on your computer. **Pull request review and root cause analysis are features of hosted Niro, because the local graph does not answer them.** See [hosted-only.md](hosted-only.md).
77
+ <!-- source: src/lib/cloudGuard.js:66-69 (the printed message: "pull request review and root cause analysis, which the local graph does not answer"); src/lib/release.js:33 (cloud: false) -->
@@ -0,0 +1,44 @@
1
+ # Plan and design with Niro
2
+
3
+ **Before you change code, find out what the change reaches.** Niro answers in both directions:
4
+
5
+ - **Upstream:** what depends on the code (its callers, and services that call it over HTTP or through events).
6
+ - **Downstream:** what the code depends on (what it calls, the tables it reads and writes, the events it sends).
7
+
8
+ ## Who and how
9
+
10
+ - **Who:** a developer planning a change, or a planning agent.
11
+ - **How:** a coding agent connected over MCP (see [connect-your-ai-assistant.md](connect-your-ai-assistant.md)), or the terminal:
12
+
13
+ ```
14
+ niro ask get_blast_radius method_fqn=OrderService.cancel
15
+ niro ask get_impact_analysis http_path=/api/orders
16
+ ```
17
+ <!-- source: src/commands/engineRoutes.js:28 (niro ask TOOL key=value) -->
18
+
19
+ ## Which tool answers which question
20
+
21
+ | Question | Tool |
22
+ |---|---|
23
+ | What does a change to this method reach, both ways? | `get_blast_radius` (default depth 3, from 1 to 5) |
24
+ | What breaks if this method, class, route or event changes? | `get_impact_analysis` (upstream by default) |
25
+ | Which routes does this project serve, and which does it call? | `find_api_endpoints`, `find_outbound_http_calls` |
26
+ | Which events are sent and handled? | `list_events`, `get_event_producers_and_handlers` |
27
+ | Does similar code already exist? | `code_grep` (text search), `resolve_name` (find a name), `list_types` (every class by name) |
28
+ <!-- source: niro-local src/niro_local/mcp/server.py:1573 (get_blast_radius), :1638 (get_impact_analysis), :1731, :1837, :1790, :1810, :2024, :1474, :1719; src/niro_local/mcp/impact.py:40-41 (depth 1 to 5) -->
29
+
30
+ **Finding reusable code by meaning is not in this release.** The tool for it, `find_reusable_code`, needs LLM documentation, which this release does not include. Use `code_grep` and `list_types` instead.
31
+ <!-- source: niro-local src/niro_local/reuse/__init__.py:37-40 (IN_THIS_RELEASE = False, "LLM documentation is not available in this release.") -->
32
+
33
+ ## Reading the answer
34
+
35
+ - An answer marked **"confidence: partial"** listed every caller it could place, and says what it could not. See [how-the-graph-works.md](how-the-graph-works.md).
36
+ - Callers across services that Niro inferred but could not confirm are listed separately, as "inferred". They are not counted in the risk.
37
+ <!-- source: niro-local src/niro_local/mcp/impact.py:1018-1022, :1140 -->
38
+
39
+ ## Playbooks
40
+
41
+ - [Change code safely](playbook-change-safely.md): the size of a planned change (`answer=count`), then its callers by name.
42
+ - [Data stores and events](playbook-data-and-events.md): every reader and writer of a table across services, and the publishers and handlers of a topic.
43
+ - [Add a feature](playbook-add-a-feature.md): what exists to copy before you design.
44
+ <!-- source: the linked pages -->
@@ -0,0 +1,30 @@
1
+ # Review changes with Niro
2
+
3
+ **When a reviewer looks at a change, the question is what else it touches.** Niro can answer that for the branch on the reviewer's own computer.
4
+
5
+ ## What works locally
6
+
7
+ With the branch checked out and its folder indexed, the reviewer (or the reviewer's coding agent) can ask four kinds of question:
8
+
9
+ - **Who depends on each changed method:** `get_blast_radius` or `get_impact_analysis`.
10
+ - **Whether a route was removed or changed:** `find_api_endpoints`, compared with the main branch's folder.
11
+ - **Whether a call to another service changed:** `find_outbound_http_calls`.
12
+ - **Which tests reach the changed code:** `get_reverse_call_chain`. Test callers are marked `[test]`.
13
+ <!-- source: niro-local src/niro_local/mcp/server.py:1528, :1573, :1638, :1731, :1837 -->
14
+
15
+ A new branch of a folder Niro already indexes gets its own copy of the graph automatically. See [worktrees-and-branches.md](worktrees-and-branches.md).
16
+ <!-- source: niro-local src/niro_local/temporary.py:175-240 -->
17
+
18
+ ## Review bots
19
+
20
+ **Review bots, such as Cursor Bugbot or CodeRabbit, cannot use the local graph in this release.** They run on someone else's servers, and the local engine is not reachable from there. See [connect-review-bots.md](connect-review-bots.md).
21
+
22
+ ## Pull request review as a product
23
+
24
+ **Automatic pull request review is a hosted Niro feature.** It runs on Niro's servers, against a copy of your code there, and the local graph does not answer it. See [hosted-only.md](hosted-only.md).
25
+ <!-- source: src/lib/cloudGuard.js:66-69 (the printed message: "pull request review and root cause analysis, which the local graph does not answer") -->
26
+
27
+ ## Playbook
28
+
29
+ [Review a change](playbook-review-a-change.md) runs the whole check on an example two-method change in Keycloak: one `get_blast_radius` call with `method_fqns` for the size, one with `answer=names` for the list, then the routes and calls to other services compared with the main branch.
30
+ <!-- source: docs/playbook-review-a-change.md (runs brk-01-multi, brk-02-names) -->
@@ -0,0 +1,35 @@
1
+ # Security and privacy across the lifecycle
2
+
3
+ **Two questions matter here:**
4
+
5
+ - What does Niro itself read, keep and send?
6
+ - How can Niro help a security review of your own code?
7
+
8
+ ## What Niro reads, keeps and sends
9
+
10
+ - **Reads:** the source, config and text files in the folders you add. It never opens real `.env` files, private keys, key stores or tool credential files.
11
+ <!-- source: niro-local src/niro_local/mcp/text_files.py -->
12
+ - **Keeps:** the graph and the build state, on your computer, in files only your user account can read.
13
+ <!-- source: niro-local src/niro_local/registry.py:53-104 (folder 0700, files 0600, umask 077) -->
14
+ - **Sends:** a small set of things, each listed in [what-leaves-your-machine.md](what-leaves-your-machine.md).
15
+
16
+ The tools your agent uses answer from the graph on your computer. In Niro's own words: "Niro's tools answer your assistant from the graph on this machine and never send the contents of your files."
17
+ <!-- source: src/lib/planUsage.js:118 (TOOLS_SENTENCE) -->
18
+
19
+ More detail:
20
+
21
+ - [secrets-and-masking.md](secrets-and-masking.md): how secrets are hidden before anything is shown or sent.
22
+ - [coverage-audit-and-consent.md](coverage-audit-and-consent.md): the one place where small pieces of code leave the computer.
23
+ - [where-things-are-stored.md](where-things-are-stored.md): every file Niro writes.
24
+
25
+ ## Using Niro in a security review
26
+
27
+ Niro can help in three ways:
28
+
29
+ - **List the attack surface.** `find_api_endpoints` lists every route your code serves. `find_outbound_http_calls` lists every call it makes to other services.
30
+ - **Follow the data.** `list_data_resources` and `get_data_resource_usage` show which code reads and writes each table.
31
+ - **Check reach before a fix.** `get_blast_radius` shows what a security fix will touch.
32
+ <!-- source: niro-local src/niro_local/mcp/server.py:1731, :1837, :1920, :1932, :1573 -->
33
+
34
+ **One limit to keep in mind:** a route built while the program runs, from values computed at that time, is not in the graph. Niro lists only routes written as fixed text, and says so in the answer.
35
+ <!-- source: niro-local src/niro_local/mcp/server.py:3849-3857, :3876-3881, :3924 -->
@@ -0,0 +1,28 @@
1
+ # Decide what to test with Niro
2
+
3
+ **To test a change well, you need to know what it reaches.** Niro lists what calls the changed code, through as many levels as you ask. It also lists the routes, tables and events on the way.
4
+
5
+ ## How
6
+
7
+ ```
8
+ niro ask get_reverse_call_chain method_fqn=PriceCalculator.total depth=3
9
+ niro ask get_blast_radius method_fqn=PriceCalculator.total
10
+ ```
11
+
12
+ - `get_reverse_call_chain` lists callers up to the depth you ask (3 by default, 8 at most), 300 to a page.
13
+ - `get_blast_radius` adds what the method calls, and the routes and events in between.
14
+ <!-- source: niro-local src/niro_local/mcp/server.py:1528 (limit 300); src/niro_local/mcp/queries.py:55-56 (default depth 3, max 8) -->
15
+
16
+ ## Things to know
17
+
18
+ - **Test code is in the graph.** Callers that are tests are marked `[test]`, so you can see which tests already reach the change.
19
+ <!-- source: niro-local TODO.md:3679 (test code is indexed) -->
20
+ - **The VERIFY purpose leaves the marks out.** With `purpose=VERIFY`, an answer gives names only, and drops the `[test]` and `[possible]` marks. Leave `purpose` empty when you need them.
21
+ <!-- source: niro-local docs/NIRO-LOCAL-ISSUES.md entry "2026-11-06, a Java call whose argument comes from a record accessor is marked `[possible]` ... and `purpose=VERIFY` drops the `[possible]` and `[test]` marks" (OPEN) -->
22
+ - **A `[possible]` caller** is one Niro could not tie down to one target. For example, the call is made on a value whose type the code does not state. Check those by reading them.
23
+ <!-- source: niro-local src/niro_local/mcp/chains.py:1945-1947 -->
24
+
25
+ ## Playbook
26
+
27
+ [Test a change](playbook-test-a-change.md) finds, in one call with `answer=locations`, the six Keycloak tests the code makes possible three levels up through an interface, of which four really run `JpaUserCredentialStore.createCredentialEntity`. Two use a user stored outside Keycloak's database, so at run time they go to another store. It also checks the list against a grep.
28
+ <!-- source: docs/playbook-test-a-change.md (runs test-01-rev) -->
@@ -0,0 +1,35 @@
1
+ # Write code with Niro
2
+
3
+ **While code is being written, the coding agent asks the graph instead of searching through files.** One question to the graph can replace many text searches and file reads. For example: "who calls this method, three levels up?"
4
+
5
+ ## Who and how
6
+
7
+ - **The coding agent** reaches Niro over MCP (the Model Context Protocol, the standard way coding agents use outside tools). Niro sets this up for 14 agents. See [connect-your-ai-assistant.md](connect-your-ai-assistant.md).
8
+ <!-- source: src/mcp/setup.js:279-414 (the CLIENTS table, 14 entries) -->
9
+ - **The developer** asks from the terminal with `niro ask`. Run it with no tool name to list the tools.
10
+ <!-- source: src/commands/engineRoutes.js:28 -->
11
+
12
+ ## What agents are taught to do
13
+
14
+ The skill Niro installs tells the agent to do four things:
15
+ <!-- source: src/mcp/localSkill.js:97-161 (NIRO_SKILL_LOCAL) -->
16
+
17
+ 1. **Explore first.** Use `code_grep`, `get_source_code`, `resolve_name`, `list_types`, `get_class_structure`, `find_api_endpoints` and `find_handler` before reading files by hand.
18
+ 2. **Check both directions before changing anything.** Use `get_blast_radius`, `get_reverse_call_chain` and `get_impact_analysis`.
19
+ 3. **Follow flows across services.** Use the HTTP, event and data tools.
20
+ 4. **Say when Niro does not apply.** For example: the folder is not indexed, or the graph is behind the files.
21
+
22
+ **Claude Code gets more help than the other agents.** Niro adds hooks to Claude Code: small commands that Claude Code runs at fixed moments. One of them shows an "impact check" before Claude Code edits a file. It is advisory only: it shows the information and never blocks the edit. To turn it off, run `touch ~/.niro/impact-gate-off`. The other agents get instruction text instead of hooks.
23
+ <!-- source: src/mcp/setup.js:782-791 (Claude Code hooks), :1376-1405, :1512-1514 ("Advisory only. Off switch: touch ~/.niro/impact-gate-off"); docs/usecases/impact-gate.md:155 -->
24
+
25
+ ## When the graph is behind your edits
26
+
27
+ The graph is rebuilt in the background about 3 seconds after a folder stops changing. If an answer is about a file that changed after the last build, the answer says so, and lists the files to read directly.
28
+ <!-- source: src/lib/localBuild.js:36 (settle 3000 ms); niro-local src/niro_local/mcp/freshness.py:583-590 -->
29
+
30
+ ## Playbooks for this stage
31
+
32
+ - [Change code safely](playbook-change-safely.md): callers before an edit, overloads, static imports, common names grep cannot narrow.
33
+ - [Add a feature](playbook-add-a-feature.md): the interface to implement, its methods, existing implementations to copy.
34
+ - [Ask for less](answer-shapes.md): `answer=count`, `locations`, `names`, `exists` and `match`, so an answer carries only what the next step needs.
35
+ <!-- source: the linked pages (niro-local 43cce717, Keycloak 968726fe66, 2026-11-10) -->