neuroplex 0.0.1 → 0.1.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 (106) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +11 -11
  3. package/dist/brain/build.d.ts +21 -0
  4. package/dist/brain/build.js +172 -0
  5. package/dist/brain/build.js.map +1 -0
  6. package/dist/brain/local.d.ts +12 -0
  7. package/dist/brain/local.js +23 -0
  8. package/dist/brain/local.js.map +1 -0
  9. package/dist/brain/stats.d.ts +23 -0
  10. package/dist/brain/stats.js +37 -0
  11. package/dist/brain/stats.js.map +1 -0
  12. package/dist/brain/status.d.ts +21 -0
  13. package/dist/brain/status.js +28 -0
  14. package/dist/brain/status.js.map +1 -0
  15. package/dist/cli/index.d.ts +2 -0
  16. package/dist/cli/index.js +208 -0
  17. package/dist/cli/index.js.map +1 -0
  18. package/dist/config/config.d.ts +62 -0
  19. package/dist/config/config.js +141 -0
  20. package/dist/config/config.js.map +1 -0
  21. package/dist/enrich/index.d.ts +8 -0
  22. package/dist/enrich/index.js +13 -0
  23. package/dist/enrich/index.js.map +1 -0
  24. package/dist/enrich/tasks.d.ts +52 -0
  25. package/dist/enrich/tasks.js +339 -0
  26. package/dist/enrich/tasks.js.map +1 -0
  27. package/dist/enrich/write.d.ts +45 -0
  28. package/dist/enrich/write.js +228 -0
  29. package/dist/enrich/write.js.map +1 -0
  30. package/dist/graph/graph.d.ts +42 -0
  31. package/dist/graph/graph.js +174 -0
  32. package/dist/graph/graph.js.map +1 -0
  33. package/dist/graph/ids.d.ts +42 -0
  34. package/dist/graph/ids.js +104 -0
  35. package/dist/graph/ids.js.map +1 -0
  36. package/dist/graph/jsonl.d.ts +31 -0
  37. package/dist/graph/jsonl.js +121 -0
  38. package/dist/graph/jsonl.js.map +1 -0
  39. package/dist/graph/schema.d.ts +89 -0
  40. package/dist/graph/schema.js +73 -0
  41. package/dist/graph/schema.js.map +1 -0
  42. package/dist/index.d.ts +22 -0
  43. package/dist/index.js +22 -0
  44. package/dist/index.js.map +1 -0
  45. package/dist/install/claude.d.ts +37 -0
  46. package/dist/install/claude.js +104 -0
  47. package/dist/install/claude.js.map +1 -0
  48. package/dist/mcp/config.d.ts +20 -0
  49. package/dist/mcp/config.js +51 -0
  50. package/dist/mcp/config.js.map +1 -0
  51. package/dist/mcp/serve.d.ts +5 -0
  52. package/dist/mcp/serve.js +12 -0
  53. package/dist/mcp/serve.js.map +1 -0
  54. package/dist/mcp/server.d.ts +9 -0
  55. package/dist/mcp/server.js +248 -0
  56. package/dist/mcp/server.js.map +1 -0
  57. package/dist/query/brain.d.ts +21 -0
  58. package/dist/query/brain.js +51 -0
  59. package/dist/query/brain.js.map +1 -0
  60. package/dist/query/queries.d.ts +116 -0
  61. package/dist/query/queries.js +224 -0
  62. package/dist/query/queries.js.map +1 -0
  63. package/dist/query/search.d.ts +43 -0
  64. package/dist/query/search.js +329 -0
  65. package/dist/query/search.js.map +1 -0
  66. package/dist/scan/assemble.d.ts +20 -0
  67. package/dist/scan/assemble.js +255 -0
  68. package/dist/scan/assemble.js.map +1 -0
  69. package/dist/scan/discover.d.ts +21 -0
  70. package/dist/scan/discover.js +119 -0
  71. package/dist/scan/discover.js.map +1 -0
  72. package/dist/scan/extract.d.ts +3 -0
  73. package/dist/scan/extract.js +11 -0
  74. package/dist/scan/extract.js.map +1 -0
  75. package/dist/scan/extractors/python.d.ts +4 -0
  76. package/dist/scan/extractors/python.js +303 -0
  77. package/dist/scan/extractors/python.js.map +1 -0
  78. package/dist/scan/extractors/typescript.d.ts +6 -0
  79. package/dist/scan/extractors/typescript.js +509 -0
  80. package/dist/scan/extractors/typescript.js.map +1 -0
  81. package/dist/scan/git.d.ts +15 -0
  82. package/dist/scan/git.js +42 -0
  83. package/dist/scan/git.js.map +1 -0
  84. package/dist/scan/merge.d.ts +14 -0
  85. package/dist/scan/merge.js +57 -0
  86. package/dist/scan/merge.js.map +1 -0
  87. package/dist/scan/parser.d.ts +23 -0
  88. package/dist/scan/parser.js +57 -0
  89. package/dist/scan/parser.js.map +1 -0
  90. package/dist/scan/resolve.d.ts +23 -0
  91. package/dist/scan/resolve.js +131 -0
  92. package/dist/scan/resolve.js.map +1 -0
  93. package/dist/scan/scan.d.ts +36 -0
  94. package/dist/scan/scan.js +74 -0
  95. package/dist/scan/scan.js.map +1 -0
  96. package/dist/scan/types.d.ts +86 -0
  97. package/dist/scan/types.js +20 -0
  98. package/dist/scan/types.js.map +1 -0
  99. package/dist/version.d.ts +2 -0
  100. package/dist/version.js +5 -0
  101. package/dist/version.js.map +1 -0
  102. package/package.json +40 -6
  103. package/skills/neuroplex/SKILL.md +94 -0
  104. package/skills/neuroplex-update/SKILL.md +37 -0
  105. package/bin/neuroplex.js +0 -8
  106. package/index.js +0 -7
@@ -0,0 +1,94 @@
1
+ ---
2
+ name: neuroplex
3
+ description: Build a Neuroplex brain for the current project - a knowledge graph of its modules, files, symbols, concepts and flows, saved in a separate "<project>-brain" folder and served to AI assistants over MCP. Use when the user asks to map, index, or "build a brain" for a codebase, or runs /neuroplex.
4
+ ---
5
+
6
+ # Neuroplex: build the project's brain
7
+
8
+ You are building a **brain** for the project in the current working directory: a knowledge graph that future AI sessions can query through MCP instead of re-reading the code. The `neuroplex` CLI does the mechanical work (parsing, graph, files). **You** add the understanding: summaries, concepts and flows.
9
+
10
+ Work through the steps in order. Keep the user informed with one short line per step.
11
+
12
+ ## 0. Set up the CLI
13
+
14
+ Use the first that works and call it `$NP` below:
15
+
16
+ 1. `neuroplex --version` (installed globally)
17
+ 2. `npx -y neuroplex@latest --version`
18
+
19
+ The version must be **0.1.0 or newer**. If it is `0.0.1` (the placeholder), stop and tell the user Neuroplex isn't published yet and they should install it from the repository (`packages/npm`: `npm install && npm run build && npm link`).
20
+
21
+ ## 1. Decide where the brain goes
22
+
23
+ Default: a sibling folder named `<project-folder>-brain` (for example `../shop-brain`). If the user named a location, use it. If the folder already contains a `neuroplex.json`, this is an update: keep going, existing knowledge is preserved.
24
+
25
+ ## 2. Structural scan
26
+
27
+ ```bash
28
+ $NP scan . --brain <brain>
29
+ ```
30
+
31
+ This parses the code and writes the graph. Report the one-line summary it prints (files, nodes, edges). If it says the project has uncommitted changes, mention that they are included.
32
+
33
+ ## 3. Enrichment loop
34
+
35
+ Repeat until `phase` is `null`:
36
+
37
+ ```bash
38
+ $NP tasks --brain <brain> --limit 3
39
+ ```
40
+
41
+ The output is compact JSON: `phase`, `tasks`, `pending` (counts per phase), `sourcePath` (where the code lives) and `resultFormat`. (`--brief` prints just the task list if you want an overview first.) For **each task**:
42
+
43
+ 1. Read `instructions`, `targets` and `context`.
44
+ 2. **Read the actual source files** listed in the context (paths are relative to `sourcePath`). Never write summaries from names alone.
45
+ 3. Write the result JSON to a temporary file outside both the project and the brain, preferably with your file-writing tool (shell heredocs break on quotes), and submit it:
46
+
47
+ ```bash
48
+ $NP write <task-id> --brain <brain> --file <tmp>/result.json
49
+ ```
50
+
51
+ 4. Check the report: fix any `warnings` (usually a mistyped node ID) and cover anything listed in `missing` with another `write`.
52
+
53
+ **Fetch again after each batch** (`--limit 3`), don't fetch everything up front: tasks change as you work. For example, a parent module's task only appears once its submodules are summarized.
54
+
55
+ Phases run in order: **modules → project → concepts → flows**. A big module is split into parts (`module:src/x@1`, `@2`…), and the module itself is summarized in the last part.
56
+
57
+ ### Writing good knowledge
58
+
59
+ - **Every ID must be copied exactly** from the task (`symbol:src/auth/login.ts#login`, `module:src/auth`, `file:src/a.ts`).
60
+ - **Summaries** explain *what it does and why it exists*, plus anything non-obvious: side effects, important constraints, surprising behavior. Don't restate the name ("`parseConfig` parses the config" is useless). Length: symbols and files 1-2 sentences; modules 2-4 sentences; project 3-6 sentences. Write in English unless the user asks otherwise.
61
+ - **Notes** (markdown) are for modules and the project: responsibilities, how the parts fit together, key decisions, gotchas. Aim for 5-20 lines; skip boilerplate headings.
62
+ - **Tags**: optional, a few lowercase words that help search (`auth`, `persistence`, `cli`).
63
+ - **Concepts**: 5-15 *domain* ideas (what the software is about), not technical layers like "utils" or "tests". Members implement each concept, most important first, at most 15; they can be IDs, paths or unique symbol names.
64
+ - **Flows**: 3-10 end-to-end journeys (a user action, a request, a command). Steps are **symbols in execution order**, ideally starting at the trigger: CLI commands (`command:scan`), HTTP routes (`GET /users`) and MCP tools (`tool:search`) are symbols too. The suggested entry points and call trees are hints: callees appear in source order and calls on local variables are missing, so read the code to confirm. Don't invent steps that aren't in the graph.
65
+ - Stale nodes (`"stale": true`) have an outdated summary: compare it to the current code and rewrite it.
66
+
67
+ ### Large projects
68
+
69
+ Each task is sized to fit in context, but a big project can have hundreds. After the first ~20 module tasks, tell the user how many remain (`pending`) and ask whether to continue, stop here (the brain is already useful), or skip ahead with `$NP tasks --brain <brain> --phase project`, and then `concepts` and `flows`.
70
+
71
+ ## 4. Build the brain repository
72
+
73
+ ```bash
74
+ $NP build --brain <brain> --git
75
+ ```
76
+
77
+ This writes the README, the overview note and `.mcp.json`, and commits everything in the brain folder (its own git repository, separate from the project).
78
+
79
+ ## 5. Plug it in
80
+
81
+ Registering the MCP server changes the user's Claude Code configuration, so **ask first** and offer the two options:
82
+
83
+ - **Just me, every project** (default): `$NP connect --brain <brain>` (runs `claude mcp add --scope user`).
84
+ - **Everyone working on this project**: `$NP connect --brain <brain> --scope project` adds the server to the project's `.mcp.json`, which they can commit.
85
+
86
+ `--dry-run` shows what would happen without changing anything. If the `claude` CLI is not available (another assistant), show the printed command and the `.mcp.json` snippet instead. Once connected, any **new** session can call `overview`, `search`, `explain`, `impact` and `path` on this project.
87
+
88
+ ## 6. Wrap up
89
+
90
+ Tell the user in a few lines:
91
+
92
+ - where the brain is and what it contains: `$NP status --brain <brain>`;
93
+ - how to refresh it after code changes: run `/neuroplex-update`, or `$NP scan` followed by the enrichment loop for stale nodes;
94
+ - that pushing the brain to its own remote lets teammates use it too.
@@ -0,0 +1,37 @@
1
+ ---
2
+ name: neuroplex-update
3
+ description: Refresh an existing Neuroplex brain after the code changed - rescan the project, then rewrite only the stale or missing AI knowledge. Use when the user asks to update or refresh the brain, or runs /neuroplex-update.
4
+ ---
5
+
6
+ # Neuroplex: refresh the brain
7
+
8
+ The project already has a brain (a folder with `neuroplex.json`, by default `../<project-folder>-brain`). Bring it up to date with the current code, spending effort only where the code changed.
9
+
10
+ Use the same CLI as `/neuroplex` (`neuroplex`, or `npx -y neuroplex@latest`, version 0.1.0 or newer), called `$NP` below.
11
+
12
+ 1. **Check how far behind it is:**
13
+
14
+ ```bash
15
+ $NP status --brain <brain>
16
+ ```
17
+
18
+ If it is up to date and no tasks are pending, say so and stop.
19
+
20
+ 2. **Rescan:**
21
+
22
+ ```bash
23
+ $NP scan . --brain <brain>
24
+ ```
25
+
26
+ Existing summaries, notes, concepts and flows are kept. Nodes whose code changed are flagged `stale`, and new code shows up as missing summaries.
27
+
28
+ 3. **Enrich only what changed:** run the loop from `/neuroplex` step 3 (`$NP tasks` → read the code → `$NP write`) until `phase` is `null`. Tasks only include stale or missing nodes, so this is usually short.
29
+ - If many modules changed, the concepts and flows may be outdated too. Offer to refresh them with `$NP tasks --brain <brain> --phase concepts` (and `--phase flows`). A result for those tasks replaces the old set.
30
+
31
+ 4. **Rebuild and commit:**
32
+
33
+ ```bash
34
+ $NP build --brain <brain> --git
35
+ ```
36
+
37
+ 5. **Report** in one or two lines: what changed (nodes added/removed, summaries rewritten) and the new indexed commit. A running `neuroplex serve` picks up the new brain automatically, so no restart is needed.
package/bin/neuroplex.js DELETED
@@ -1,8 +0,0 @@
1
- #!/usr/bin/env node
2
- 'use strict';
3
-
4
- const { version } = require('../package.json');
5
-
6
- console.log(`🧠 Neuroplex v${version}`);
7
- console.log('A plug-and-play brain for your AI. Work in progress, not usable yet.');
8
- console.log('Follow along: https://github.com/MurilloY/Neuroplex');
package/index.js DELETED
@@ -1,7 +0,0 @@
1
- 'use strict';
2
-
3
- // Placeholder: Neuroplex is in early development.
4
- // See https://github.com/MurilloY/Neuroplex
5
- module.exports = {
6
- version: require('./package.json').version,
7
- };