Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: tests

on:
push:
branches: [main]
pull_request:

jobs:
pytest:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest]
python-version: ["3.10", "3.12"]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- run: pip install -e '.[dev]'
- run: pytest -q
20 changes: 9 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Second Brain

[![tests](https://github.com/alfielambert/second-brain/actions/workflows/tests.yml/badge.svg)](https://github.com/alfielambert/second-brain/actions/workflows/tests.yml)
[![License: MIT](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)
![Python 3.10+](https://img.shields.io/badge/python-3.10%2B-blue.svg)

Most second brains store information.

This one decides what deserves to become knowledge.
Expand Down Expand Up @@ -78,19 +82,13 @@ this" by walking the chain back to the original evidence. See

## Architecture

**Local mode** - everything on your machine, nothing required beyond this repo:

```
Sources -> Connectors -> Claim Store -> KEP -> Governed Knowledge -> Local AI
```
<p align="center">
<img src="docs/assets/how-it-works.svg" alt="Evidence from X bookmarks, notes and connectors becomes append-only claims. KEP decides whether each claim is auto-applied, held for approval or logged as a signal. Governed Markdown knowledge is compiled for a local AI, or served to many agents through OpenLore." width="900">
</p>

**Multiplayer mode** - once more than one agent needs the same knowledge:

```
Sources -> Connectors -> Claim Store -> KEP -> Governed Knowledge -> OpenLore -> Multiple AI agents
```
**Local mode** runs everything on your machine and needs nothing beyond this repo. **Multiplayer mode** adds OpenLore at the end, once more than one agent needs the same knowledge.

[OpenLore](https://github.com/aakarim/go-openlore) is an open-source
[OpenLore](https://github.com/aakarim/OpenLore) is an open-source
knowledge server for AI agents. **Second Brain creates and governs
knowledge. OpenLore distributes governed knowledge to agents.** The two
are cleanly separable, and OpenLore is entirely optional - you do not
Expand Down
2 changes: 1 addition & 1 deletion docs/architecture.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ Sources -> Connectors -> Claim Store -> KEP -> Governed Knowledge -> OpenLore ->
```

The only thing that changes is the last step. OpenLore
(https://github.com/aakarim/go-openlore) is a separate, already
(https://github.com/aakarim/OpenLore) is a separate, already
open-source, MIT-licensed knowledge server - not a proprietary add-on. It
knows nothing about claims, KEP, or this schema; it just serves a directory
of markdown+frontmatter over SSH/MCP/HTTP to authenticated identities.
Expand Down
108 changes: 108 additions & 0 deletions docs/assets/how-it-works.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions docs/openlore-integration.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ synchronization problem wearing a knowledge-management costume.

## What OpenLore is

[OpenLore](https://github.com/aakarim/go-openlore) is a separate,
[OpenLore](https://github.com/aakarim/OpenLore) is a separate,
already-open-source (MIT), agent-native knowledge server. It serves a
directory of markdown+frontmatter to authenticated agent identities over
SSH, MCP (HTTP or stdio), and a JSON REST API - with per-identity scoped
Expand All @@ -42,7 +42,7 @@ with no manual copying.
go install github.com/aakarim/go-openlore/cmd/openlore@latest
```

(Requires Go 1.26+. See the [OpenLore README](https://github.com/aakarim/go-openlore#installation) for other install methods.)
(Requires Go 1.26+. See the [OpenLore README](https://github.com/aakarim/OpenLore/blob/main/docs/start/quickstart.md#install) for other install methods.)

### 2. Point it at governed knowledge

Expand Down
18 changes: 16 additions & 2 deletions tests/test_subprocess_timeout.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,5 +72,19 @@ def test_grandchild_process_does_not_survive_the_timeout_kill():

if content: # the grandchild got far enough to write its pid before being killed
grandchild_pid = int(content)
with pytest.raises(ProcessLookupError):
os.kill(grandchild_pid, 0) # signal 0: just checks if the process exists
assert not _is_running(grandchild_pid)


def _is_running(pid):
"""True if pid exists and is not a zombie. A killed orphan stays a
zombie until init reaps it, and some container inits never do, so
os.kill(pid, 0) alone would report a dead process as alive."""
try:
os.kill(pid, 0) # signal 0: just checks if the process exists
except ProcessLookupError:
return False
try:
with open(f"/proc/{pid}/stat") as f:
return f.read().rsplit(")", 1)[1].split()[0] != "Z"
except FileNotFoundError: # no /proc (macOS): trust os.kill
return True
Loading