@time-machine-lab/tmlbrain 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.
- package/README.md +152 -0
- package/bin/tmlbrain.js +1653 -0
- package/docs/.gitkeep +0 -0
- package/docs/api/.gitkeep +0 -0
- package/docs/architecture.md +84 -0
- package/docs/backup.md +76 -0
- package/docs/decisions/.gitkeep +1 -0
- package/docs/decisions/0001-core-runtime.md +18 -0
- package/docs/design/.gitkeep +0 -0
- package/docs/fixtures/knowledge-sample/alpha-reference.md +14 -0
- package/docs/fixtures/knowledge-sample/project-alpha.md +18 -0
- package/docs/fixtures/patches/update-alpha-reference.patch +9 -0
- package/docs/indexing.md +32 -0
- package/docs/install.md +166 -0
- package/docs/preview/.gitkeep +0 -0
- package/docs/roadmap.md +27 -0
- package/docs/runtime.md +95 -0
- package/docs/server-api.md +120 -0
- package/docs/spec/.gitkeep +0 -0
- package/docs/spikes/cocoindex-local-indexing.md +31 -0
- package/docs/spikes/lightrag-retrieval.md +27 -0
- package/docs/sql/.gitkeep +0 -0
- package/docs/sync.md +110 -0
- package/knowledge/README.md +71 -0
- package/knowledge/_templates/area.md +18 -0
- package/knowledge/_templates/decision.md +18 -0
- package/knowledge/_templates/meeting.md +18 -0
- package/knowledge/_templates/project.md +18 -0
- package/knowledge/_templates/reference.md +18 -0
- package/knowledge/_templates/resource.md +18 -0
- package/package.json +41 -0
- package/scripts/README.md +12 -0
- package/scripts/backup/server-to-github.ps1 +20 -0
- package/scripts/backup/server-to-github.sh +13 -0
- package/scripts/docker/server-entrypoint.sh +84 -0
- package/scripts/install/install.ps1 +44 -0
- package/scripts/install/install.sh +41 -0
- package/scripts/release/parse-auto-release.js +166 -0
- package/scripts/sync/.gitkeep +1 -0
- package/scripts/sync/post-receive.sample +8 -0
- package/skills/tmlbrain/SKILL.md +192 -0
- package/skills/tmlbrain/agents/openai.yaml +7 -0
package/README.md
ADDED
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
# TMLBrain
|
|
2
|
+
|
|
3
|
+
TMLBrain (T M L 外置大脑) is a lightweight, AI-native team knowledge base.
|
|
4
|
+
|
|
5
|
+
It is designed as TML's external brain: easy to search, easy to modify,
|
|
6
|
+
safe to back up, and friendly to AI agents that need to read, update, classify,
|
|
7
|
+
and maintain shared knowledge.
|
|
8
|
+
|
|
9
|
+
## Core Idea
|
|
10
|
+
|
|
11
|
+
TMLBrain keeps three coordinated copies of the knowledge base:
|
|
12
|
+
|
|
13
|
+
- Local snapshot: used by team members and AI agents for fast search and local indexes.
|
|
14
|
+
- Server knowledge base: the shared source and only normal write surface.
|
|
15
|
+
- Dedicated knowledge repository: server-side restore, disaster recovery, and version history.
|
|
16
|
+
|
|
17
|
+
## Initial Scope
|
|
18
|
+
|
|
19
|
+
- Maintain a clean folder structure for documents.
|
|
20
|
+
- Let AI search local snapshots and request server-side precise Markdown updates.
|
|
21
|
+
- Pull read-only local snapshots from the server copy.
|
|
22
|
+
- Back up the server copy to GitHub on a server-side schedule.
|
|
23
|
+
- Build an optional online reading layer later.
|
|
24
|
+
|
|
25
|
+
## Repository Layout
|
|
26
|
+
|
|
27
|
+
```text
|
|
28
|
+
TMLBrain/
|
|
29
|
+
knowledge/ Team knowledge files.
|
|
30
|
+
skills/tmlbrain/ AI skill for search, server-side writes, lifecycle, and sync workflows.
|
|
31
|
+
bin/tmlbrain.js CLI/server runtime for search, validation, indexing, sync, writes, and backup.
|
|
32
|
+
scripts/sync/ Local/server/GitHub synchronization scripts.
|
|
33
|
+
scripts/index/ Search index and knowledge graph scripts.
|
|
34
|
+
docs/ Architecture, decisions, and operating docs.
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## Local Tooling
|
|
38
|
+
|
|
39
|
+
The npm package exposes a dependency-light CLI:
|
|
40
|
+
|
|
41
|
+
```text
|
|
42
|
+
npx @time-machine-lab/tmlbrain client install
|
|
43
|
+
tmlbrain find "keyword"
|
|
44
|
+
tmlbrain save --title "Title" --content "Content"
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
Clients use Node for exact search and local indexing. HTTP-only clients do not
|
|
48
|
+
need Git. Server-side writes use Node plus Git from the server worktree.
|
|
49
|
+
Python-based CocoIndex and LightRAG support are optional graph retrieval
|
|
50
|
+
enhancements.
|
|
51
|
+
|
|
52
|
+
Interactive client install asks for a server URL. Leave it empty to start in
|
|
53
|
+
local-only mode, or provide the TMLBrain server URL and token to enable team
|
|
54
|
+
sync and server-side writes.
|
|
55
|
+
|
|
56
|
+
Non-interactive client install:
|
|
57
|
+
|
|
58
|
+
```text
|
|
59
|
+
npx @time-machine-lab/tmlbrain client install --server http://server-host:7389 --token secret --yes
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
## Server Docker
|
|
63
|
+
|
|
64
|
+
The server is deployed separately from clients and requires a token:
|
|
65
|
+
|
|
66
|
+
```text
|
|
67
|
+
docker run -d --name tmlbrain-server \
|
|
68
|
+
-p 7389:7389 \
|
|
69
|
+
-e TMLBRAIN_SERVER_TOKEN=change-me \
|
|
70
|
+
-e TMLBRAIN_KNOWLEDGE_REPO=https://github.com/Time-Machine-Lab/TMLBrainKnowledge.git \
|
|
71
|
+
-e TMLBRAIN_KNOWLEDGE_REF=main \
|
|
72
|
+
-v tmlbrain-data:/data \
|
|
73
|
+
<DOCKER_REPO>:latest
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
Or with Compose:
|
|
77
|
+
|
|
78
|
+
```text
|
|
79
|
+
TMLBRAIN_SERVER_TOKEN=change-me docker compose up -d
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
Client npm releases and server Docker releases are separate artifacts, but they
|
|
83
|
+
are published from the same commit-message driven workflow:
|
|
84
|
+
`.github/workflows/auto-release.yml`.
|
|
85
|
+
|
|
86
|
+
Only pushes to `main` are considered. A release runs when the HEAD commit
|
|
87
|
+
message contains `<Auto>` and a version flag:
|
|
88
|
+
|
|
89
|
+
```text
|
|
90
|
+
[tml-brain]<Auto> release server and client -v:0.1.0 -rp:7389 -de:<-e KEY=value>
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
- `-v` is required and becomes both the npm package version and Docker image
|
|
94
|
+
version; use a Docker-compatible value such as `0.1.0` or `0.1.0-beta.1`.
|
|
95
|
+
- `-rp` sets the default server port baked into the Docker image; it defaults
|
|
96
|
+
to `7389`.
|
|
97
|
+
- `-de` is optional runtime Docker argument metadata recorded in
|
|
98
|
+
the commit message and may also be copied into `prod_deploy.log` manually.
|
|
99
|
+
|
|
100
|
+
The workflow publishes `@time-machine-lab/tmlbrain` to npm, pushes the server
|
|
101
|
+
image to the Docker repository configured by `DOCKER_REPO`, and then deploys
|
|
102
|
+
that image to the configured server with `SERVER_HOST`, `SERVER_USER`, and
|
|
103
|
+
`SERVER_PWD`. Docker images are tagged as `latest`, `version`, and `vversion`.
|
|
104
|
+
The workflow does not mutate repository files; if
|
|
105
|
+
maintainers want a production release note, update `prod_deploy.log` manually
|
|
106
|
+
before committing the auto-release instruction.
|
|
107
|
+
|
|
108
|
+
Required GitHub Actions secrets:
|
|
109
|
+
|
|
110
|
+
```text
|
|
111
|
+
NPM_TOKEN
|
|
112
|
+
DOCKER_USERNAME
|
|
113
|
+
DOCKER_PASSWORD
|
|
114
|
+
DOCKER_REPO
|
|
115
|
+
SERVER_HOST
|
|
116
|
+
SERVER_USER
|
|
117
|
+
SERVER_PWD
|
|
118
|
+
TMLBRAIN_SERVER_TOKEN
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
For a private dedicated knowledge repository, also configure:
|
|
122
|
+
|
|
123
|
+
```text
|
|
124
|
+
TMLBRAIN_KNOWLEDGE_REPO
|
|
125
|
+
TMLBRAIN_KNOWLEDGE_TOKEN
|
|
126
|
+
TMLBRAIN_KNOWLEDGE_REF
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
`TMLBRAIN_KNOWLEDGE_REPO` must be an HTTPS URL such as
|
|
130
|
+
`https://github.com/org/repo.git`. `TMLBRAIN_KNOWLEDGE_TOKEN` is a GitHub token
|
|
131
|
+
with write access to that repository. Fine-grained tokens are preferred;
|
|
132
|
+
classic tokens also work when they have the right repository scope: use `repo`
|
|
133
|
+
for private repositories, or `public_repo` only for public repositories. The
|
|
134
|
+
running server needs this credential to push knowledge backups to GitHub;
|
|
135
|
+
clients never need it.
|
|
136
|
+
|
|
137
|
+
The Docker image contains the TMLBrain tool and knowledge templates only. Real
|
|
138
|
+
team knowledge should live in a dedicated knowledge repository configured with
|
|
139
|
+
`TMLBRAIN_KNOWLEDGE_REPO`. If the server volume already has `/data/worktree`,
|
|
140
|
+
the container reuses it instead of cloning again.
|
|
141
|
+
For team deployments, do not omit `TMLBRAIN_KNOWLEDGE_REPO`; without it, a new
|
|
142
|
+
volume starts from a template-only skeleton intended for development or blank
|
|
143
|
+
starts.
|
|
144
|
+
|
|
145
|
+
## Guiding Principles
|
|
146
|
+
|
|
147
|
+
- Files are the source of truth.
|
|
148
|
+
- Markdown is the default document format.
|
|
149
|
+
- Small, precise server-side edits are preferred over whole-document rewrites.
|
|
150
|
+
- Every document should have a clear owner, status, and update path.
|
|
151
|
+
- AI should help maintain the knowledge base instead of only searching it.
|
|
152
|
+
- Clients do not push to the server repository or dedicated knowledge repository.
|