neurain 0.1.0-alpha.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 (89) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/LICENSE +57 -0
  3. package/README.md +205 -0
  4. package/SECURITY.md +22 -0
  5. package/bin/neurain.mjs +7 -0
  6. package/docs/comparison-mem0.en.md +22 -0
  7. package/docs/connect-claude.en.md +48 -0
  8. package/docs/connect-claude.kr.md +51 -0
  9. package/docs/connect-codex.en.md +38 -0
  10. package/docs/connect-codex.kr.md +40 -0
  11. package/docs/connect-gemini.en.md +71 -0
  12. package/docs/connect-gemini.kr.md +71 -0
  13. package/docs/connect-runtime.en.md +61 -0
  14. package/docs/connect-runtime.kr.md +61 -0
  15. package/docs/development-status.en.md +157 -0
  16. package/docs/development-status.kr.md +157 -0
  17. package/docs/knowledge-os.en.md +105 -0
  18. package/docs/knowledge-os.kr.md +106 -0
  19. package/docs/pricing.en.md +14 -0
  20. package/docs/privacy-and-data-flow.en.md +25 -0
  21. package/docs/public-saas-readiness.en.md +39 -0
  22. package/docs/quickstart.en.md +64 -0
  23. package/docs/quickstart.kr.md +64 -0
  24. package/docs/release-checklist.en.md +38 -0
  25. package/docs/safety.en.md +36 -0
  26. package/docs/self-improvement-90-roadmap.en.md +429 -0
  27. package/docs/self-improvement-90-roadmap.kr.md +429 -0
  28. package/docs/self-improving-workflows.en.md +163 -0
  29. package/docs/self-improving-workflows.kr.md +163 -0
  30. package/docs/support.en.md +17 -0
  31. package/docs/troubleshooting.en.md +35 -0
  32. package/package.json +36 -0
  33. package/src/cli.mjs +261 -0
  34. package/src/core/adopt.mjs +304 -0
  35. package/src/core/answer_eval.mjs +450 -0
  36. package/src/core/capabilities.mjs +217 -0
  37. package/src/core/capture_durable.mjs +181 -0
  38. package/src/core/classify.mjs +237 -0
  39. package/src/core/compile_desk.mjs +324 -0
  40. package/src/core/complete.mjs +108 -0
  41. package/src/core/config.mjs +142 -0
  42. package/src/core/connect.mjs +355 -0
  43. package/src/core/curator.mjs +351 -0
  44. package/src/core/daemon.mjs +536 -0
  45. package/src/core/digest.mjs +155 -0
  46. package/src/core/doctor.mjs +115 -0
  47. package/src/core/durable.mjs +96 -0
  48. package/src/core/envelope.mjs +97 -0
  49. package/src/core/flush.mjs +190 -0
  50. package/src/core/fs.mjs +121 -0
  51. package/src/core/init.mjs +194 -0
  52. package/src/core/journal.mjs +269 -0
  53. package/src/core/labels.mjs +117 -0
  54. package/src/core/lessons.mjs +793 -0
  55. package/src/core/lifecycle.mjs +1138 -0
  56. package/src/core/link_check.mjs +180 -0
  57. package/src/core/live_cases.mjs +221 -0
  58. package/src/core/onboard.mjs +175 -0
  59. package/src/core/plan_receipt.mjs +177 -0
  60. package/src/core/plan_writeback.mjs +176 -0
  61. package/src/core/queue.mjs +62 -0
  62. package/src/core/queue_archive.mjs +87 -0
  63. package/src/core/queue_model.mjs +161 -0
  64. package/src/core/queue_write.mjs +28 -0
  65. package/src/core/recall.mjs +1802 -0
  66. package/src/core/recall_bench.mjs +275 -0
  67. package/src/core/recall_corpus.mjs +152 -0
  68. package/src/core/recall_facts.mjs +233 -0
  69. package/src/core/recall_intel.mjs +233 -0
  70. package/src/core/recall_lexical.mjs +269 -0
  71. package/src/core/recap.mjs +78 -0
  72. package/src/core/review_queue.mjs +131 -0
  73. package/src/core/review_worker.mjs +284 -0
  74. package/src/core/route.mjs +73 -0
  75. package/src/core/safety.mjs +57 -0
  76. package/src/core/scheduler.mjs +697 -0
  77. package/src/core/search.mjs +54 -0
  78. package/src/core/secret_scan.mjs +143 -0
  79. package/src/core/semantic.mjs +187 -0
  80. package/src/core/source_digest.mjs +56 -0
  81. package/src/core/source_digest_gen.mjs +311 -0
  82. package/src/core/stage.mjs +105 -0
  83. package/src/core/status.mjs +175 -0
  84. package/src/core/vault_state.mjs +115 -0
  85. package/src/core/watch.mjs +282 -0
  86. package/src/core/wiki_log.mjs +29 -0
  87. package/src/core/wrap.mjs +62 -0
  88. package/src/mcp/server.mjs +865 -0
  89. package/templates/starter-vault/README.md +9 -0
@@ -0,0 +1,106 @@
1
+ # [kr] Neurain Knowledge OS
2
+
3
+ 버전: 0.2
4
+
5
+ Neurain Knowledge OS는 Neurain을 외부에 설명할 때 쓰는 제품 브랜드명입니다.
6
+
7
+ 현재 shipped 범위, 테스트 증거, 남은 gap은 `docs/development-status.kr.md`를 기준으로 봅니다.
8
+
9
+ 고객에게 가장 짧게 설명하면 이렇습니다.
10
+
11
+ > 내 폴더를 그대로 가져오고, 내 지식을 지키고, 어떤 AI agent든 붙여서 쓴다.
12
+
13
+ ## 무엇인가
14
+
15
+ Neurain Knowledge OS는 사용자의 실제 업무 폴더 위에서 동작하는 local-first 지식 운영 레이어입니다.
16
+
17
+ AI agent가 다음을 안정적으로 하도록 돕습니다.
18
+
19
+ - 폴더 구조 이해
20
+ - 오래 남길 wiki 유지
21
+ - 출처 보존
22
+ - 중요한 업무 기록 캡처
23
+ - 이전 세션에서 배운 lesson 노출
24
+ - 위험한 저장 전 확인
25
+ - 다른 agent에서도 이어서 작업
26
+ - 백업과 복구 기준 유지
27
+
28
+ ## 무엇이 아닌가
29
+
30
+ Neurain은 LLM이 아닙니다.
31
+
32
+ Claude, GPT, Gemini, DeepSeek, local model을 대체하지 않습니다. 특정 모델 하나에 종속될 필요도 없습니다.
33
+
34
+ 또한 Neurain은 숨겨진 cloud memory database가 아닙니다. 기본 방향은 local-first입니다. 사용자의 폴더와 Neurain vault가 source of truth입니다.
35
+
36
+ ## 3개 레이어
37
+
38
+ 정확한 설명은 3개 레이어로 해야 합니다.
39
+
40
+ | 레이어 | 예시 | 역할 |
41
+ |---|---|---|
42
+ | Model layer | Claude, GPT, Gemini, DeepSeek, local models | 생각하고 답변 생성 |
43
+ | Agent runtime layer | Agent Runtime, Codex, Claude Code, Gemini CLI, OpenClaw | prompt assembly, model call, tool execution, turn 관리 |
44
+ | Knowledge OS layer | Neurain Knowledge OS | 출처 기반 지식, wiki, memory, lesson, receipt, recovery state 관리 |
45
+
46
+ 여기서 Agent Runtime은 prompt assembly, model call, tool execution, session lifecycle을 소유하는 일반 AI host를 뜻합니다. 이 문서의 "Agent Runtime"은 항상 runtime을 뜻하며, LLM을 뜻하지 않습니다. 그래서 이 runtime을 Claude나 Gemini 모델과 직접 비교하면 카테고리 오류입니다.
47
+
48
+ ## Runtime를 써도 Neurain이 필요한 이유
49
+
50
+ Runtime는 agent loop를 강하게 소유하는 runtime입니다. Neurain의 역할은 다릅니다.
51
+
52
+ Neurain은 사용자가 다음을 원할 때 필요합니다.
53
+
54
+ - 내 업무 폴더를 source of truth로 유지
55
+ - Codex, Claude Code, Gemini CLI, Agent Runtime 사이에서 지식 이동 가능
56
+ - chat memory가 아니라 출처 기반 wiki 유지
57
+ - durable write 전 safety gate
58
+ - 변경사항 rollback receipt
59
+ - private 자료 local 유지
60
+ - AI host가 바뀌어도 markdown만으로 복구 가능한 구조
61
+
62
+ 가장 좋은 관계는 "runtime vs Neurain"이 아닙니다. 사용자가 agent runtime을 앞단에서 쓰고 싶다면, "runtime in front, Neurain behind"가 더 정확합니다.
63
+
64
+ Before/after 예시:
65
+
66
+ - Neurain 전: 사용자가 Codex에서 Claude Code나 Agent Runtime로 바꿀 때마다 프로젝트 맥락을 다시 설명합니다.
67
+ - Neurain 후: 각 host가 같은 local startup, wiki, receipt, reviewed lesson을 읽으므로, 기억은 하나의 chat이 아니라 폴더에 남습니다.
68
+
69
+ ## 외부 브랜딩 단어
70
+
71
+ 외부 문서에서는 아래 표현을 우선 사용합니다.
72
+
73
+ - Neurain Knowledge OS
74
+ - local-first knowledge layer
75
+ - source-grounded wiki
76
+ - portable AI memory
77
+ - reviewed lessons
78
+ - safety receipts
79
+ - folder adoption
80
+ - agent-independent continuity
81
+
82
+ 아래 표현은 아직 증명 전까지 과장입니다.
83
+
84
+ - 완전 자율 self-improvement
85
+ - 자동 durable learning
86
+ - public SaaS ready
87
+ - enterprise governance ready
88
+ - Runtime runtime보다 더 좋다
89
+
90
+ ## 신규 사용자 흐름
91
+
92
+ 1. 사용자는 기존 업무 폴더를 가지고 있습니다.
93
+ 2. `npx neurain init <folder>`를 실행합니다.
94
+ 3. Neurain이 깨끗한 local vault를 만듭니다.
95
+ 4. `npx neurain adopt <work-folder> --dry-run`으로 먼저 스캔합니다.
96
+ 5. Neurain은 쓰기 전에 계획과 위험을 설명합니다.
97
+ 6. 사용자는 Codex, Claude Code, Gemini CLI, Agent Runtime, 다른 host 중 하나를 연결합니다.
98
+ 7. 작업 후 `neurain wrap <folder> --dry-run`을 실행합니다.
99
+ 8. Neurain은 상태, 위험, recap, lesson 후보를 보여줍니다.
100
+ 9. 오래 남는 변경은 명시적 확인이 있어야만 진행됩니다.
101
+
102
+ ## 브랜딩 규칙
103
+
104
+ 외부 문서 첫 언급은 "Neurain Knowledge OS"를 사용합니다. 이후에는 "Neurain"으로 줄여도 됩니다.
105
+
106
+ 내부 문서에서 "AI Knowledge OS"는 카테고리 표현으로 사용할 수 있지만, 제품 브랜드는 "Neurain Knowledge OS"입니다.
@@ -0,0 +1,14 @@
1
+ # Pricing Hypothesis
2
+
3
+ Neurain alpha is open-source local-first software.
4
+
5
+ Future pricing should not charge for storing a user's private knowledge by default. The first paid layer should be a control plane:
6
+
7
+ | Plan | Likely buyer | Included |
8
+ |---|---|---|
9
+ | Free | Individual trial users | CLI, local vault, MCP connector |
10
+ | Pro | Solo founders, researchers, operators | guided setup, update channel, backup reminders |
11
+ | Team | small teams | shared policies, team setup, support |
12
+ | Enterprise | regulated teams | SSO, audit posture, deployment support, private onboarding |
13
+
14
+ This is a hypothesis, not a live price list.
@@ -0,0 +1,25 @@
1
+ # Privacy And Data Flow
2
+
3
+ Neurain is local-first.
4
+
5
+ ## What Stays Local
6
+
7
+ - Starter vault files.
8
+ - Adopted folder metadata.
9
+ - Raw captures.
10
+ - Wiki and area files.
11
+ - Adoption receipts and rollback receipts.
12
+
13
+ ## What An AI Host Can See
14
+
15
+ When you connect Codex, Claude Code, Gemini CLI, or Runtime through MCP, that host can call the exposed Neurain tools allowed by that connector. In alpha those tools are limited to read, capture where explicitly exposed, scan, eval, redacted live-case scaffold, and preview surfaces. Gemini uses a read-first allowlist and does not include raw capture by default. MCP cannot promote lessons, append lifecycle events, run the daemon, or silently overwrite durable wiki files.
16
+
17
+ ## What Neurain Does Not Do In Alpha
18
+
19
+ - It does not install a background daemon. A user can start a foreground daemon loop with `neurain daemon run`.
20
+ - It does not upload your vault to a Neurain cloud.
21
+ - It does not silently compile or overwrite durable wiki files through MCP.
22
+ - It does not store source knowledge in a hidden vector database.
23
+ - It does not claim human-reviewed live evidence from `live-cases scaffold`; that scaffold stores hash-only source refs until a human fills reviewed cases locally.
24
+
25
+ Secret-like capture input is refused by the MCP capture tool.
@@ -0,0 +1,39 @@
1
+ # Public SaaS Readiness
2
+
3
+ Neurain alpha separates three scores:
4
+
5
+ | Track | Meaning | Current alpha evidence |
6
+ |---|---|---|
7
+ | Internal system readiness | The private operating system works for the maintainer. | Existing private Neurain vault. |
8
+ | Public alpha readiness | A new user can install, initialize, scan, and connect. | This CLI and MCP package. |
9
+ | Public SaaS GA readiness | A broad market can self-serve, trust, pay, and recover. | Not complete yet. |
10
+
11
+ ## Current Alpha Readiness
12
+
13
+ This repo raises public readiness by adding the missing product entrypoint. See `docs/development-status.en.md` for the canonical implementation snapshot.
14
+
15
+ - publishable npm package
16
+ - installable `neurain` binary
17
+ - read-only non-developer onboarding with `neurain onboard`
18
+ - starter vault initialization
19
+ - existing-folder adoption scan
20
+ - receipt-backed adoption apply and rollback
21
+ - Codex, Claude Code, Gemini CLI, and Agent Runtime MCP connection paths
22
+ - stdio MCP connector with bounded tool surface
23
+ - lifecycle safety eval
24
+ - semantic and hybrid recall
25
+ - live-content recall coverage
26
+ - redacted live-case scaffold
27
+ - safety and privacy docs
28
+ - CI test workflow
29
+
30
+ Estimated public SaaS readiness after this alpha: 80/100 only if npm and GitHub publication are completed and at least one external tester succeeds. Without actual publication, readiness should be described as publish-ready alpha, not market live. Internal readiness scripts can report score 100 for publish-ready alpha gates, but that is not a public SaaS GA score.
31
+
32
+ ## Remaining For 90+
33
+
34
+ - local GUI for non-developers
35
+ - hosted control plane for account, license, updates, and optional team metadata
36
+ - public Trust Center and status page
37
+ - external user tests across real folders
38
+ - pricing and support operations
39
+ - backup and recovery UX that non-developers can complete
@@ -0,0 +1,64 @@
1
+ # Neurain Quickstart
2
+
3
+ Version: v0.2
4
+
5
+ ## 0. Ask Neurain what to do first
6
+
7
+ ```bash
8
+ npx neurain onboard ~/NeurainDemo --lang en
9
+ ```
10
+
11
+ This is read-only. If the folder is empty or missing, it tells you how to create a vault. If the folder already has work files, it tells you to scan before writing anything.
12
+
13
+ ## 1. Create a local vault
14
+
15
+ ```bash
16
+ npx neurain init ~/NeurainDemo --lang en
17
+ ```
18
+
19
+ ## 2. Check it
20
+
21
+ ```bash
22
+ npx neurain doctor ~/NeurainDemo
23
+ ```
24
+
25
+ ## 3. Connect an AI host
26
+
27
+ ```bash
28
+ npx neurain connect codex ~/NeurainDemo --dry-run
29
+ npx neurain connect claude ~/NeurainDemo --dry-run
30
+ npx neurain connect gemini ~/NeurainDemo --dry-run
31
+ npx neurain connect runtime ~/NeurainDemo --dry-run
32
+ ```
33
+
34
+ Run without `--dry-run` after reviewing the command.
35
+
36
+ ## 4. Search local knowledge
37
+
38
+ ```bash
39
+ npx neurain search ~/NeurainDemo "what is this folder for"
40
+ ```
41
+
42
+ ## 5. Preview the self-improving loop
43
+
44
+ ```bash
45
+ npx neurain wrap ~/NeurainDemo --dry-run
46
+ npx neurain lessons candidates ~/NeurainDemo
47
+ ```
48
+
49
+ Neurain can suggest recurring lesson candidates after meaningful work. MCP never promotes them. CLI can promote a safe reviewed candidate only when you pass the exact confirmation phrase:
50
+
51
+ ```bash
52
+ npx neurain lessons promote ~/NeurainDemo --candidate-id <candidate-id> --confirm "1건 저장 진행"
53
+ npx neurain lessons rollback ~/NeurainDemo --receipt output/receipts/lessons/<receipt>.json
54
+ ```
55
+
56
+ For multi-area vaults, add `--area <name>` to inspect one area. Preview commands do not scan every area by default.
57
+
58
+ ## 6. Adopt an existing folder
59
+
60
+ ```bash
61
+ npx neurain adopt ~/Work --dry-run
62
+ ```
63
+
64
+ Neurain will scan first. It will not write adapter files unless you pass `--apply` and the exact confirmation phrase shown by the scan.
@@ -0,0 +1,64 @@
1
+ # Neurain 빠른 시작
2
+
3
+ Version: v0.2
4
+
5
+ ## 0. 처음엔 Neurain에게 다음 행동을 물어보기
6
+
7
+ ```bash
8
+ npx neurain onboard ~/NeurainDemo --lang ko
9
+ ```
10
+
11
+ 이 명령은 읽기 전용입니다. 폴더가 비어 있거나 없으면 vault 생성 방법을 알려주고, 이미 업무 파일이 있는 폴더라면 어떤 것도 쓰기 전에 먼저 스캔하라고 안내합니다.
12
+
13
+ ## 1. 로컬 vault 만들기
14
+
15
+ ```bash
16
+ npx neurain init ~/NeurainDemo --lang ko
17
+ ```
18
+
19
+ ## 2. 상태 확인
20
+
21
+ ```bash
22
+ npx neurain doctor ~/NeurainDemo
23
+ ```
24
+
25
+ ## 3. AI host 연결
26
+
27
+ ```bash
28
+ npx neurain connect codex ~/NeurainDemo --dry-run
29
+ npx neurain connect claude ~/NeurainDemo --dry-run
30
+ npx neurain connect gemini ~/NeurainDemo --dry-run
31
+ npx neurain connect runtime ~/NeurainDemo --dry-run
32
+ ```
33
+
34
+ 출력된 명령이 맞으면 `--dry-run`을 제거하고 실행합니다.
35
+
36
+ ## 4. 로컬 지식 검색
37
+
38
+ ```bash
39
+ npx neurain search ~/NeurainDemo "이 폴더는 무엇을 위한 폴더야"
40
+ ```
41
+
42
+ ## 5. 자기개선 루프 미리보기
43
+
44
+ ```bash
45
+ npx neurain wrap ~/NeurainDemo --dry-run
46
+ npx neurain lessons candidates ~/NeurainDemo
47
+ ```
48
+
49
+ Neurain은 의미 있는 작업 후 반복될 만한 lesson 후보를 제안할 수 있습니다. MCP는 후보를 승격하지 않습니다. CLI에서는 안전한 후보를 사용자가 검토한 뒤 정확한 확인 문구를 넣을 때만 승격할 수 있습니다.
50
+
51
+ ```bash
52
+ npx neurain lessons promote ~/NeurainDemo --candidate-id <candidate-id> --confirm "1건 저장 진행"
53
+ npx neurain lessons rollback ~/NeurainDemo --receipt output/receipts/lessons/<receipt>.json
54
+ ```
55
+
56
+ multi-area vault에서는 `--area <name>`을 붙여 특정 area만 확인합니다. Preview command는 모든 area를 기본으로 스캔하지 않습니다.
57
+
58
+ ## 6. 기존 업무 폴더 연결 전 스캔
59
+
60
+ ```bash
61
+ npx neurain adopt ~/Work --dry-run
62
+ ```
63
+
64
+ Neurain은 먼저 읽기 전용으로 스캔합니다. 어댑터 파일 쓰기는 `--apply`와 화면에 표시된 정확한 확인 문구가 있을 때만 진행됩니다.
@@ -0,0 +1,38 @@
1
+ # Release Checklist
2
+
3
+ Use this checklist before publishing an alpha release.
4
+
5
+ ## Local Checks
6
+
7
+ ```bash
8
+ npm ci
9
+ npm test
10
+ node scripts/readiness.mjs --json
11
+ npm run readiness
12
+ npm pack --dry-run
13
+ npm publish --dry-run --tag alpha
14
+ ```
15
+
16
+ ## Product Safety
17
+
18
+ - No private user content.
19
+ - No local absolute paths.
20
+ - No secrets.
21
+ - No silent durable write through MCP.
22
+ - Public docs explain local-first data flow.
23
+ - `docs/development-status.en.md` and `docs/development-status.kr.md` match the latest shipped commit, test count, readiness score, and package version.
24
+
25
+ ## Publication
26
+
27
+ - GitHub repo publication policy is decided. Private beta can remain private; public alpha should be public.
28
+ - GitHub Actions test workflow passes.
29
+ - npm package is published or package name is reserved with `npm publish --tag alpha`.
30
+ - Release notes include alpha caveats.
31
+
32
+ ## External Validation
33
+
34
+ - One user completes quickstart.
35
+ - One Codex connection succeeds.
36
+ - One Claude Code connection succeeds.
37
+ - One Gemini CLI connection dry-run succeeds.
38
+ - One existing folder scan produces a clear recommendation.
@@ -0,0 +1,36 @@
1
+ # Safety
2
+
3
+ Neurain alpha is designed around preview-first operation.
4
+
5
+ ## Adoption Safety
6
+
7
+ `neurain adopt <folder>` is read-only by default. It checks for:
8
+
9
+ - secret-like text
10
+ - generated folders
11
+ - caches
12
+ - symlinks
13
+ - large files
14
+ - binary-heavy or risky folders
15
+
16
+ Writes require:
17
+
18
+ ```bash
19
+ --apply --confirm "<N>건 저장 진행"
20
+ ```
21
+
22
+ ## Rollback
23
+
24
+ Adoption writes a receipt listing every created file. Rollback removes only files listed in that receipt and only if their content hash still matches.
25
+
26
+ ## MCP Safety
27
+
28
+ The alpha MCP connector exposes no silent durable write tool. It can search, report status, scan adoption risk, run read-only evals, produce redacted live-case scaffolds, and preview workflow reports.
29
+
30
+ Capture is append-only when exposed, and secret-like capture input is refused. Gemini CLI uses a read-first allowlist that omits raw capture by default.
31
+
32
+ MCP does not expose lifecycle emit, daemon run/stop, curator write, recall rebuild write, lesson promotion, or silent durable wiki writes.
33
+
34
+ ## Live-Case Safety
35
+
36
+ `neurain live-cases scaffold` stores hash-only source refs and templates. It does not store raw source text, absolute local paths, secret-like content, or instruction-injection content. It reports `reviewed_live_user_evidence:false` and `human_judged:false` until a human fills safe local case files.