@simbimbo/brainstem 0.0.1 → 0.0.3

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 (41) hide show
  1. package/CHANGELOG.md +87 -0
  2. package/README.md +99 -3
  3. package/brainstem/__init__.py +3 -0
  4. package/brainstem/api.py +257 -0
  5. package/brainstem/connectors/__init__.py +1 -0
  6. package/brainstem/connectors/logicmonitor.py +26 -0
  7. package/brainstem/connectors/types.py +16 -0
  8. package/brainstem/demo.py +64 -0
  9. package/brainstem/fingerprint.py +44 -0
  10. package/brainstem/ingest.py +108 -0
  11. package/brainstem/instrumentation.py +38 -0
  12. package/brainstem/interesting.py +62 -0
  13. package/brainstem/models.py +80 -0
  14. package/brainstem/recurrence.py +112 -0
  15. package/brainstem/scoring.py +38 -0
  16. package/brainstem/storage.py +428 -0
  17. package/docs/adapters.md +435 -0
  18. package/docs/api.md +380 -0
  19. package/docs/architecture.md +333 -0
  20. package/docs/connectors.md +66 -0
  21. package/docs/data-model.md +290 -0
  22. package/docs/design-governance.md +595 -0
  23. package/docs/mvp-flow.md +109 -0
  24. package/docs/roadmap.md +87 -0
  25. package/docs/scoring.md +424 -0
  26. package/docs/v0.0.1.md +277 -0
  27. package/docs/vision.md +85 -0
  28. package/package.json +6 -14
  29. package/pyproject.toml +18 -0
  30. package/tests/fixtures/sample_syslog.log +6 -0
  31. package/tests/test_api.py +319 -0
  32. package/tests/test_canonicalization.py +28 -0
  33. package/tests/test_demo.py +25 -0
  34. package/tests/test_fingerprint.py +22 -0
  35. package/tests/test_ingest.py +15 -0
  36. package/tests/test_instrumentation.py +16 -0
  37. package/tests/test_interesting.py +36 -0
  38. package/tests/test_logicmonitor.py +22 -0
  39. package/tests/test_recurrence.py +16 -0
  40. package/tests/test_scoring.py +21 -0
  41. package/tests/test_storage.py +294 -0
package/docs/v0.0.1.md ADDED
@@ -0,0 +1,277 @@
1
+ # brAInstem v0.0.1 Scope
2
+
3
+ _Status: governing release-scope doc for the first public prototype release_
4
+
5
+ ## Purpose
6
+
7
+ This document defines the **honest scope** of brAInstem `v0.0.1`.
8
+
9
+ Its job is to prevent the first release from becoming one of these failure modes:
10
+ - a vague architecture dump with no usable artifact
11
+ - a fake platform release that overclaims universal capability
12
+ - a connector chase that ignores the core product thesis
13
+ - a technically interesting prototype that still cannot tell an operator what matters
14
+
15
+ If a feature or claim is not consistent with this document, it does not belong in `v0.0.1`.
16
+
17
+ ---
18
+
19
+ ## 1. What `v0.0.1` is
20
+
21
+ brAInstem `v0.0.1` is an **experimental self-contained operational memory prototype**.
22
+
23
+ It should prove that brAInstem can:
24
+ 1. ingest early source types into a shared internal pipeline
25
+ 2. normalize those inputs into a canonical event stream
26
+ 3. assign and describe **attention**
27
+ 4. detect recurring weak signals in a meaningful way
28
+ 5. emit concise operator-facing output that says what deserves attention
29
+
30
+ This is a real release, but it is a **first stake in the ground**, not a mature operational platform.
31
+
32
+ ---
33
+
34
+ ## 2. Release thesis
35
+
36
+ The thesis of `v0.0.1` is:
37
+
38
+ > A self-contained local runtime can ingest operational events, normalize them into one canonical stream, assign attention, and surface weak recurring patterns in a form that a human operator can understand.
39
+
40
+ If `v0.0.1` proves that cleanly, it succeeds.
41
+
42
+ ---
43
+
44
+ ## 3. Buyer/user framing for `v0.0.1`
45
+
46
+ `v0.0.1` is not yet a polished commercial product release.
47
+ It is a technically honest prototype release aimed at:
48
+ - builders
49
+ - early evaluators
50
+ - operators who want to understand the product direction
51
+ - future pilot conversations with MSP / lean ops buyers
52
+
53
+ It should still be written and structured as if it is the beginning of a real product line.
54
+
55
+ ---
56
+
57
+ ## 4. In-scope for `v0.0.1`
58
+
59
+ ### 4.1 Canonical model
60
+ The release must define a clear canonical event concept.
61
+
62
+ At minimum, the docs and code should consistently support the idea that:
63
+ - different source types feed one shared normalized internal event stream
64
+ - downstream scoring/discovery logic is driven by that normalized stream
65
+
66
+ ### 4.2 Early ingestion path(s)
67
+ `v0.0.1` must support at least a narrow but real ingestion story.
68
+
69
+ That may be:
70
+ - syslog-like local file/log ingestion
71
+ - structured event ingestion through an early adapter path
72
+ - demo or sample-driven ingestion that proves the pipeline end-to-end
73
+
74
+ It does **not** need to be broad.
75
+ It does need to be real.
76
+
77
+ ### 4.3 Attention-oriented language and behavior
78
+ The release should establish **attention** as a core concept.
79
+
80
+ That means:
81
+ - docs use the term clearly
82
+ - outputs and scoring concepts reflect attention, not only raw significance
83
+ - weak signals are framed as events/signatures that can earn more attention over time
84
+
85
+ ### 4.4 Weak-signal recurrence detection
86
+ The release must show at least one meaningful weak-signal detection path.
87
+
88
+ For `v0.0.1`, recurrence is sufficient as the main proven candidate class.
89
+
90
+ ### 4.5 Operator-facing output
91
+ The release must produce at least one operator-meaningful output form.
92
+
93
+ Examples:
94
+ - interesting items
95
+ - weak-signal digest
96
+ - concise candidate summary
97
+
98
+ The output must aim to answer:
99
+ - what is happening?
100
+ - why should I care?
101
+
102
+ ### 4.6 Self-contained local runtime story
103
+ The release should be runnable locally without requiring a large external services footprint.
104
+
105
+ ### 4.7 Persistence
106
+ The release should retain enough state locally to support a meaningful prototype memory story.
107
+ SQLite-backed storage is acceptable and desirable.
108
+
109
+ ### 4.8 Demoability
110
+ `v0.0.1` must be demoable end-to-end without hand-wavy claims.
111
+
112
+ A builder should be able to run the prototype and see:
113
+ - ingest
114
+ - normalization
115
+ - recurrence/attention interpretation
116
+ - operator-facing output
117
+
118
+ ---
119
+
120
+ ## 5. Explicitly out of scope for `v0.0.1`
121
+
122
+ The following are **not required** for `v0.0.1` and should not be overclaimed.
123
+
124
+ ### 5.1 Full universal intake apparatus
125
+ Not required yet:
126
+ - broad connector zoo
127
+ - mature syslog appliance behavior
128
+ - every file/API/stream type
129
+ - complete transport/runtime hardening across all sources
130
+
131
+ ### 5.2 Production-grade always-on infrastructure
132
+ Not required yet:
133
+ - fully hardened long-running daemon behavior
134
+ - high-scale backpressure handling across all inputs
135
+ - complete queue/spool runtime guarantees
136
+ - broad operational telemetry and runtime admin surfaces
137
+
138
+ ### 5.3 Full multi-tenant MSP platform
139
+ Not required yet:
140
+ - sophisticated tenant isolation/workflows
141
+ - tenant admin model
142
+ - role/permission systems
143
+ - commercial packaging of multi-client operation
144
+
145
+ ### 5.4 Full discovery apparatus breadth
146
+ Not required yet:
147
+ - mature burst detection
148
+ - mature self-heal analysis
149
+ - mature precursor analysis
150
+ - mature spread correlation
151
+ - advanced historical incident recall
152
+
153
+ ### 5.5 UI-heavy product surfaces
154
+ Not required yet:
155
+ - rich dashboard
156
+ - review workflow UI
157
+ - polished multi-surface operator console
158
+
159
+ ### 5.6 Black-box AI sophistication
160
+ Not required yet:
161
+ - heavy model-driven ranking
162
+ - opaque semantic scoring
163
+ - large-model-first product logic
164
+
165
+ If those things appear, they must be described as future direction, not as completed scope.
166
+
167
+ ---
168
+
169
+ ## 6. Required acceptance criteria for `v0.0.1`
170
+
171
+ A release is acceptable as `v0.0.1` only if the following are true.
172
+
173
+ ### 6.1 Category clarity
174
+ The docs clearly present brAInstem as:
175
+ - an operational memory prototype for weak signals
176
+ - not a generic AIOps platform
177
+ - not a generic observability or SIEM replacement
178
+
179
+ ### 6.2 Scope honesty
180
+ The docs explicitly separate:
181
+ - what the release proves now
182
+ - what the future architecture aspires to
183
+
184
+ ### 6.3 Canonical event story
185
+ The docs and code align around the idea of a normalized internal event stream.
186
+
187
+ ### 6.4 Attention story
188
+ The release establishes attention as a first-class concept in architecture, scoring, or operator-facing wording.
189
+
190
+ ### 6.5 End-to-end proof
191
+ There is a reproducible path that shows:
192
+ - input
193
+ - normalization
194
+ - recurrence/interesting-item logic
195
+ - operator-facing output
196
+
197
+ ### 6.6 Local run story
198
+ A reader can understand how to install and run the prototype locally.
199
+
200
+ ### 6.7 No fake platform claims
201
+ The release does not claim broad universal ingestion or production appliance maturity unless actually implemented and proven.
202
+
203
+ ---
204
+
205
+ ## 7. Recommended release messaging
206
+
207
+ ### Good release framing
208
+ - experimental prototype
209
+ - first operational memory runtime cut
210
+ - weak-signal recurrence and attention prototype
211
+ - self-contained local runtime proof
212
+
213
+ ### Bad release framing
214
+ - complete AIOps platform
215
+ - production-ready universal event appliance
216
+ - full MSP operational intelligence suite
217
+ - generalized autonomous operations engine
218
+
219
+ ---
220
+
221
+ ## 8. Minimal implementation target for `v0.0.1`
222
+
223
+ If implementation work is done for this release, it should be tightly bounded.
224
+
225
+ ### Good implementation targets
226
+ - align output terminology with attention/interesting items
227
+ - tighten demo path so it looks more like a real product artifact
228
+ - make recurrence output more concise and operator-readable
229
+ - improve docs/install/demo instructions
230
+ - ensure the current test path is runnable in a known environment
231
+
232
+ ### Bad implementation targets
233
+ - broad refactors for imagined future scale
234
+ - building many connectors prematurely
235
+ - engineering the full day-1 robust intake appliance before cutting `v0.0.1`
236
+ - heavy UI work
237
+
238
+ ---
239
+
240
+ ## 9. Relationship to the next milestone
241
+
242
+ `v0.0.1` is intentionally narrower than the true day-1 product ambition.
243
+
244
+ The next serious milestone after `v0.0.1` should focus on the **robust input apparatus** described in the governance doc:
245
+ - stronger intake runtime
246
+ - adapter contract
247
+ - durable buffering/spooling
248
+ - syslog/API intake hardening
249
+ - parse/decode health visibility
250
+
251
+ That work should happen **after** we have a truthful first release on the board.
252
+
253
+ ---
254
+
255
+ ## 10. Release checklist
256
+
257
+ Before calling the release done, confirm:
258
+ - [ ] README reflects the real wedge and scope
259
+ - [ ] design-governance doc exists and is linked
260
+ - [ ] architecture doc reflects the attention/canonical-stream model
261
+ - [ ] release scope doc exists (`v0.0.1.md`)
262
+ - [ ] current output/demo path is operator-legible
263
+ - [ ] tests or runnable validation path are documented honestly
264
+ - [ ] release notes do not overclaim capabilities
265
+
266
+ ---
267
+
268
+ ## 11. Final governing statement for `v0.0.1`
269
+
270
+ brAInstem `v0.0.1` succeeds if it is a small, truthful, runnable release that demonstrates the beginning of a real product:
271
+ - one canonical stream
272
+ - one attention model
273
+ - one weak-signal discovery path
274
+ - one operator-facing output worth looking at
275
+
276
+ That is enough for a first release.
277
+ Anything beyond that is bonus, not the bar.
package/docs/vision.md ADDED
@@ -0,0 +1,85 @@
1
+ # Vision
2
+
3
+ ## Category
4
+
5
+ **Operational Memory Engine**
6
+
7
+ brAInstem is an operational memory engine for logs and events. It is designed to ingest noisy machine activity, remember patterns over time, and surface the things humans should care about even when no traditional alert fired.
8
+
9
+ ## Problem statement
10
+
11
+ MSPs and operators are flooded with logs yet still blind to meaningful issues.
12
+
13
+ The missing capability is not collection. It is memory.
14
+
15
+ Systems generate too many events for humans to remember:
16
+ - what happened last week
17
+ - which recurring glitches self-resolved
18
+ - what patterns often precede bigger incidents
19
+ - which low-grade anomalies matter in a specific customer environment
20
+
21
+ Traditional tooling is optimized for thresholds and outages. brAInstem is optimized for weak signals and human significance.
22
+
23
+ ## Core promise
24
+
25
+ > brAInstem notices what your systems keep doing that your team keeps missing.
26
+
27
+ ## Why it matters
28
+
29
+ Many real problems do not present as hard failures:
30
+ - VPN tunnels flap and recover before alerts fire
31
+ - services restart repeatedly but come back too fast to page
32
+ - auth weirdness accumulates below security thresholds
33
+ - backup, DNS, firewall, or cert issues keep recurring without ever becoming a sustained outage
34
+
35
+ Humans feel the pain later, but the systems never crossed the right machine thresholds at the right time.
36
+
37
+ ## What makes brAInstem different
38
+
39
+ Existing systems ask:
40
+ - did a threshold breach?
41
+ - did an SLO fail?
42
+ - is the host down?
43
+
44
+ brAInstem asks:
45
+ - has this happened repeatedly?
46
+ - is it becoming more frequent?
47
+ - does it correlate with other weak signals?
48
+ - has this pattern mattered before?
49
+ - should a human know even if the machine recovered?
50
+
51
+ ## Product principles
52
+
53
+ - Human-threshold significance over raw severity
54
+ - Memory over dashboard sprawl
55
+ - Explainability over black-box scoring
56
+ - Local-first where practical
57
+ - Tenant-aware by default
58
+ - Promote only meaning, not raw noise
59
+
60
+ ## First users
61
+
62
+ Primary:
63
+ - MSP owners
64
+ - MSP technicians
65
+ - NOC teams
66
+ - infrastructure operators
67
+
68
+ ## First use cases
69
+
70
+ - recurring VPN instability
71
+ - repeated auth anomalies
72
+ - service restart storms after changes
73
+ - network flaps that self-resolve
74
+ - weak precursors before customer-facing tickets
75
+
76
+ ## Non-goals
77
+
78
+ For the early product, brAInstem is not trying to be:
79
+ - a full SIEM replacement
80
+ - a full observability suite
81
+ - a generic metrics platform
82
+ - a compliance engine
83
+ - a generic chatbot over infinite logs
84
+
85
+ It is a memory-driven event intelligence system.
package/package.json CHANGED
@@ -1,21 +1,13 @@
1
1
  {
2
2
  "name": "@simbimbo/brainstem",
3
- "version": "0.0.1",
3
+ "version": "0.0.3",
4
4
  "description": "brAInstem — operational memory for weak signals.",
5
5
  "license": "MIT",
6
+ "type": "module",
7
+ "scripts": {
8
+ "test": "python3 -m pytest -q"
9
+ },
6
10
  "publishConfig": {
7
11
  "access": "public"
8
- },
9
- "repository": {
10
- "type": "git",
11
- "url": "https://github.com/simbimbo/brainstem.git"
12
- },
13
- "keywords": [
14
- "memory",
15
- "logs",
16
- "events",
17
- "msp",
18
- "operations",
19
- "observability"
20
- ]
12
+ }
21
13
  }
package/pyproject.toml ADDED
@@ -0,0 +1,18 @@
1
+ [build-system]
2
+ requires = ["setuptools>=68", "wheel"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "brainstem"
7
+ version = "0.0.3"
8
+ description = "brAInstem — operational memory for weak signals."
9
+ readme = "README.md"
10
+ requires-python = ">=3.9"
11
+ authors = [
12
+ { name = "Steven Imbimbo" }
13
+ ]
14
+ license = { text = "MIT" }
15
+ dependencies = ["fastapi>=0.111"]
16
+
17
+ [tool.pytest.ini_options]
18
+ testpaths = ["tests"]
@@ -0,0 +1,6 @@
1
+ Mar 22 00:00:01 fw-01 charon: VPN tunnel dropped and recovered
2
+ Mar 22 00:00:03 fw-01 charon: VPN tunnel dropped and recovered
3
+ Mar 22 00:00:05 fw-01 charon: VPN tunnel dropped and recovered
4
+ Mar 22 00:01:10 fw-01 sshd: Failed password for admin from 10.1.2.3 port 54422
5
+ Mar 22 00:01:12 fw-01 sshd: Failed password for admin from 10.1.2.3 port 54425
6
+ Mar 22 00:03:20 app-01 systemd: service restarted unexpectedly