@hawon/nexus 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 (78) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +147 -0
  3. package/dist/cli/index.js +852 -0
  4. package/dist/index.js +42 -0
  5. package/dist/mcp/server.js +178 -0
  6. package/package.json +45 -0
  7. package/scripts/demo-hero.sh +52 -0
  8. package/scripts/demo-injection.sh +25 -0
  9. package/scripts/demo-map.sh +19 -0
  10. package/scripts/demo-review.sh +40 -0
  11. package/scripts/demo-sessions.sh +19 -0
  12. package/scripts/demo.sh +101 -0
  13. package/src/cli/index.ts +1015 -0
  14. package/src/codebase/index.ts +8 -0
  15. package/src/codebase/mapper.ts +485 -0
  16. package/src/codebase/onboard.ts +200 -0
  17. package/src/codebase/types.ts +43 -0
  18. package/src/config/index.ts +2 -0
  19. package/src/config/types.ts +14 -0
  20. package/src/config/validator.ts +368 -0
  21. package/src/cost/index.ts +3 -0
  22. package/src/cost/tracker.ts +290 -0
  23. package/src/cost/types.ts +34 -0
  24. package/src/index.ts +53 -0
  25. package/src/mcp/server.ts +283 -0
  26. package/src/memory-engine/compressor.ts +97 -0
  27. package/src/memory-engine/context-window.ts +113 -0
  28. package/src/memory-engine/index.ts +6 -0
  29. package/src/memory-engine/store.ts +371 -0
  30. package/src/memory-engine/types.ts +32 -0
  31. package/src/obsidian/daily-note.ts +84 -0
  32. package/src/obsidian/exporter.ts +310 -0
  33. package/src/obsidian/index.ts +4 -0
  34. package/src/obsidian/moc.ts +169 -0
  35. package/src/obsidian/types.ts +16 -0
  36. package/src/parser/discover.ts +57 -0
  37. package/src/parser/index.ts +15 -0
  38. package/src/parser/openclaw-parser.ts +275 -0
  39. package/src/parser/parse.ts +283 -0
  40. package/src/parser/types.ts +45 -0
  41. package/src/parser/unified.ts +61 -0
  42. package/src/promptguard/advanced-rules.ts +173 -0
  43. package/src/promptguard/entropy.ts +295 -0
  44. package/src/promptguard/evolution/auto-update.ts +182 -0
  45. package/src/promptguard/evolution/corpus.ts +224 -0
  46. package/src/promptguard/evolution/index.ts +23 -0
  47. package/src/promptguard/evolution/rule-evolver.ts +347 -0
  48. package/src/promptguard/index.ts +9 -0
  49. package/src/promptguard/multilingual-rules.ts +276 -0
  50. package/src/promptguard/normalize.ts +240 -0
  51. package/src/promptguard/rules.ts +172 -0
  52. package/src/promptguard/scanner.ts +285 -0
  53. package/src/promptguard/semantic.ts +302 -0
  54. package/src/promptguard/token-analysis.ts +292 -0
  55. package/src/promptguard/types.ts +83 -0
  56. package/src/review/analyzer.ts +860 -0
  57. package/src/review/diff-reviewer.ts +191 -0
  58. package/src/review/index.ts +10 -0
  59. package/src/review/types.ts +38 -0
  60. package/src/skills/context-engine.ts +863 -0
  61. package/src/skills/extractor.ts +224 -0
  62. package/src/skills/global-context.ts +726 -0
  63. package/src/skills/index.ts +29 -0
  64. package/src/skills/library.ts +189 -0
  65. package/src/skills/pattern-engine.ts +712 -0
  66. package/src/skills/render-evolved.ts +160 -0
  67. package/src/skills/skill-reconciler.ts +703 -0
  68. package/src/skills/smart-extractor.ts +843 -0
  69. package/src/skills/types.ts +18 -0
  70. package/src/skills/wisdom-extractor.ts +737 -0
  71. package/src/superdev-evolution/index.ts +3 -0
  72. package/src/superdev-evolution/skill-manager.ts +266 -0
  73. package/src/superdev-evolution/types.ts +20 -0
  74. package/src/testing/health-check.ts +387 -0
  75. package/src/testing/index.ts +3 -0
  76. package/src/testing/test-fixer.ts +129 -0
  77. package/src/testing/types.ts +18 -0
  78. package/tsconfig.json +16 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 hawonb711-tech
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,147 @@
1
+ # nexus
2
+
3
+ The all-in-one AI developer framework — session intelligence, code review, prompt injection defense, infinite memory, and self-evolving skills.
4
+
5
+ **15 modules · 15 CLI commands · 14 MCP tools · 14,000+ lines · zero deps**
6
+
7
+ ## Features
8
+
9
+ | Module | What it does |
10
+ |--------|-------------|
11
+ | **Multi-platform Parser** | Discover and parse sessions from Claude Code and OpenClaw |
12
+ | **Obsidian Export** | Structured markdown with frontmatter, backlinks, MOC, Daily Notes |
13
+ | **Prompt Injection Guard** | 6-layer, 82-rule detection across 8 languages |
14
+ | **Code Review** | 19 detectors: AI slop, bugs, security, performance, dead code |
15
+ | **Codebase Mapping** | Architecture map, dependency graph, entry points, hotspots |
16
+ | **Test Health** | Broken imports, stale mocks, missing tests, coverage estimate |
17
+ | **Cost Monitor** | AI API cost tracking, budget alerts, spike detection |
18
+ | **Config Validator** | Exposed secrets, missing env vars, insecure defaults |
19
+ | **Infinite Memory** | 4-tier hierarchical store with TF-IDF search, auto-compression |
20
+ | **Context Engine** | Bayesian intent classifier + conversation state machine |
21
+ | **Global Context** | Thread weaving, user state model, topic switch detection |
22
+ | **Pattern Engine** | Cross-session pattern evolution with drift analysis |
23
+ | **Smart Extractor** | Episode segmentation + decision point identification |
24
+ | **Wisdom Extractor** | Extracts principles ("when X, do Y because Z"), not procedures |
25
+ | **Skill Reconciler** | Quality gate, conditional branches, preference learning |
26
+
27
+ ## Install
28
+
29
+ ```bash
30
+ npm install -g @hawon/nexus
31
+ ```
32
+
33
+ ## Quick Start
34
+
35
+ ```bash
36
+ # Sync all sessions to Obsidian (Claude Code + OpenClaw)
37
+ nexus sync --vault ~/MyVault
38
+
39
+ # Scan for prompt injection
40
+ nexus scan "Ignore all previous instructions"
41
+
42
+ # Review code
43
+ nexus review src/app.ts
44
+
45
+ # Map codebase architecture
46
+ nexus map .
47
+
48
+ # Full vault reorganization with wisdom pipeline
49
+ nexus reorganize
50
+ ```
51
+
52
+ ## CLI Commands
53
+
54
+ | Command | Description |
55
+ |---------|-------------|
56
+ | `sync` | Sync all sessions to Obsidian (multi-platform) |
57
+ | `reorganize` | Clean rebuild with wisdom + skill pipeline |
58
+ | `sessions` | List all discovered sessions |
59
+ | `export <id>` | Export a single session |
60
+ | `skills` | View extracted refined skills |
61
+ | `skills search <q>` | Search skills by keyword |
62
+ | `status` | Vault sync status |
63
+ | `scan <text>` | Prompt injection detection |
64
+ | `review <file>` | Code review (19 detectors) |
65
+ | `map [dir]` | Codebase architecture map |
66
+ | `onboard [dir]` | Onboarding guide generation |
67
+ | `test-health [dir]` | Test suite health check |
68
+ | `config [dir]` | Config/env validation |
69
+ | `cost` | AI API cost report |
70
+ | `memory <search\|stats>` | Persistent memory operations |
71
+
72
+ ## MCP Server
73
+
74
+ Nexus runs as an MCP server with 14 tools for Claude Code, OpenClaw, and any MCP-compatible agent.
75
+
76
+ ```json
77
+ {
78
+ "mcpServers": {
79
+ "nexus": {
80
+ "command": "npx",
81
+ "args": ["@hawon/nexus-mcp"]
82
+ }
83
+ }
84
+ }
85
+ ```
86
+
87
+ ### MCP Tools
88
+
89
+ | Tool | Description |
90
+ |------|-------------|
91
+ | `nexus_sessions` | List all AI sessions |
92
+ | `nexus_parse_session` | Parse a specific session |
93
+ | `nexus_scan` | Prompt injection detection (6 layers) |
94
+ | `nexus_is_safe` | Quick injection check (true/false) |
95
+ | `nexus_review` | Code review (19 detectors) |
96
+ | `nexus_map` | Codebase architecture mapping |
97
+ | `nexus_onboard` | Onboarding guide generation |
98
+ | `nexus_test_health` | Test suite health check |
99
+ | `nexus_config` | Config/env validation |
100
+ | `nexus_cost` | AI API cost report |
101
+ | `nexus_memory_search` | Search persistent memory |
102
+ | `nexus_memory_save` | Save to persistent memory |
103
+ | `nexus_skills` | List refined skills |
104
+
105
+ ## Skill Extraction Pipeline
106
+
107
+ 6-layer pipeline that turns raw AI conversations into refined, reusable knowledge:
108
+
109
+ ```
110
+ Session JSONL → Smart Extractor (episode segmentation)
111
+ → Context Engine (Bayesian intent + state machine)
112
+ → Global Context (thread weaving + user state)
113
+ → Pattern Engine (cross-session evolution)
114
+ → Wisdom Extractor (principles, not procedures)
115
+ → Skill Reconciler (quality gate + preferences)
116
+ → Refined Skills → Obsidian
117
+ ```
118
+
119
+ **"이럴 때는 이렇게"** — not "Edit src/file.ts at line 42"
120
+
121
+ ## Architecture
122
+
123
+ ```
124
+ nexus
125
+ ├── parser/ Multi-platform (Claude Code + OpenClaw)
126
+ ├── obsidian/ Markdown + MOC + Daily Notes
127
+ ├── skills/ 6-layer extraction pipeline
128
+ │ ├── context-engine Bayesian intent + state machine
129
+ │ ├── global-context Thread weaving + user state
130
+ │ ├── pattern-engine Cross-session evolution
131
+ │ ├── smart-extractor Episode segmentation
132
+ │ ├── wisdom-extractor Principles, not procedures
133
+ │ └── skill-reconciler Quality gate + preferences
134
+ ├── promptguard/ Prompt injection (82 rules, 8 languages)
135
+ ├── review/ Code review (19 detectors)
136
+ ├── codebase/ Architecture mapping + onboarding
137
+ ├── testing/ Test health + fix suggestions
138
+ ├── cost/ API cost tracking + budget alerts
139
+ ├── config/ Config/env validation
140
+ ├── memory-engine/ Infinite hierarchical memory
141
+ ├── mcp/ MCP server (14 tools)
142
+ └── cli/ Unified CLI (15 commands)
143
+ ```
144
+
145
+ ## License
146
+
147
+ MIT