How OpenHuman Syncs Memory to an Obsidian Wiki Vault via Git Mirror
OpenHuman synchronizes its SQLite memory store to an Obsidian-compatible Git repository by converting each memory update into Markdown files under a docs/ folder, then automatically committing and pushing those changes to a configured remote that serves as the Obsidian vault root.
OpenHuman implements a bidirectional bridge between its internal AI memory system and external knowledge management tools through a Git-based mirroring system. According to the tinyhumansai/openhuman source code, this feature transforms the application's SQLite-backed conversation memory into version-controlled Markdown files that Obsidian can render as a native wiki vault.
The Git-Backed Memory Architecture
OpenHuman stores user memory—including notes, conversation metadata, and structured knowledge like people and tasks—in a local SQLite database. When the Git-backed memory feature (also referenced as memory-git or the broader gitbooks integration) is enabled, the application mirrors this database to a Git repository working tree.
The synchronization creates a first-class, version-controlled Markdown representation of the memory. Obsidian opens this folder as a Vault, treating the Git working tree as its root directory. Because the folder is a standard Git repository, Obsidian instantly displays any new or updated files that OpenHuman commits, and users can pull external changes back into the local vault.
Configuration and Setup
Enabling the Git Mirror
Enable the feature by setting memory.git.enabled = true or activating the broader gitbooks integration in .openhuman/config.toml. The configuration schema in src/openhuman/config/schema/memory.rs defines the remote URL, branch target, and commit message templates.
# .openhuman/config.toml
[gitbooks]
enabled = true
repo = "git@github.com:me/openhuman-vault.git"
branch = "main"
commit_message = "OpenHuman memory sync"
When enabled = true, OpenHuman initializes the memory-to-Git pipeline on startup. The system stores the remote repository URL and authentication credentials according to the schema defined in the memory configuration module.
Configuring the Obsidian Vault
Point Obsidian at the same local folder that OpenHuman uses as its Git working tree:
- Clone the remote repository that OpenHuman pushes to (e.g.,
git clone git@github.com:me/openhuman-vault.git ~/obsidian-vault). - In Obsidian, select Open folder and choose
~/obsidian-vault. - Obsidian automatically indexes all
*.mdfiles that OpenHuman generates under thedocs/subdirectory.
The gitbooks/guides/connect-obsidian.md file in the repository provides the official user-facing guide for this connection process.
The Synchronization Pipeline
The sync process runs automatically after each conversation turn or can be triggered manually via the API. The pipeline involves three core components: the diff engine, the Git orchestrator, and the Markdown serializer.
Diff Engine and Markdown Generation
The src/openhuman/memory/diff.rs module implements the diff engine that detects changes between the current SQLite store and the previous Git-mirrored state. When changes are detected, the engine serializes modified entries as Markdown files.
Specifically, the diff logic:
- Compares the current memory state against the last committed snapshot.
- Writes changed notes as Markdown files to the
docs/folder within the repository. - Generates structured filenames (e.g.,
docs/notes/2024-03-15-meeting.md) that Obsidian recognizes as wiki links.
Git Operations and Remote Sync
The src/openhuman/gitbooks/mod.rs module provides the higher-level GitBooks service that coordinates the synchronization. This service exposes the sync_memory() method, which:
- Invokes the diff engine to generate file updates.
- Stages all modified Markdown files using Git commands.
- Executes
git commitwith the configured message template. - Pushes the commit to the configured remote branch.
This process ensures that the Obsidian vault remains up-to-date with the AI's internal memory state without manual file exports.
Programmatic Access
Developers can force a memory synchronization programmatically using the GitbooksService API. This is useful for scripting custom backup schedules or integrating OpenHuman into larger automation workflows.
use openhuman::gitbooks::GitbooksService;
use openhuman::core::CoreBuilder;
use openhuman::core::Access;
#[tokio::main]
async fn main() -> anyhow::Result<()> {
let core = CoreBuilder::new()
.access(Access::full())
.build()
.await?;
// Force a full memory sync – this is what the background task does after each turn.
let gitbooks = GitbooksService::from_core(&core);
gitbooks.sync_memory().await?;
Ok(())
}
The GitbooksService::from_core() constructor initializes the service with access to the core memory stores, while sync_memory().await executes the full diff-and-push pipeline synchronously.
Summary
- OpenHuman stores internal memory in SQLite, but can mirror this to a Git repository via the
gitbooksfeature. - The
src/openhuman/memory/diff.rsengine converts database changes into Markdown files under adocs/folder. - The
src/openhuman/gitbooks/mod.rsservice orchestrates Git commands, automatically committing and pushing updates to a remote. - Obsidian opens the same Git working tree as a Vault, displaying the AI-generated Markdown as editable wiki notes.
- Configuration is managed through
.openhuman/config.tomlusing the schema defined insrc/openhuman/config/schema/memory.rs.
Frequently Asked Questions
How do I enable Git-backed memory in OpenHuman?
Set enabled = true in the [gitbooks] section of .openhuman/config.toml and specify a valid Git remote URL in the repo field. The feature activates on the next application start, creating the initial commit if the repository is empty.
What folder structure does OpenHuman create for Obsidian?
OpenHuman writes Markdown files to a docs/ subdirectory within the Git working tree. Each note receives a structured filename (typically including dates or UUIDs) that appears instantly in Obsidian's file explorer when committed.
Can I use Obsidian to edit notes that sync back to OpenHuman?
Yes. Because the folder is a standard Git working tree, any edits made in Obsidian can be committed and pushed back to the remote. When OpenHuman runs git pull on the same repository, it can ingest those changes, though the sync is primarily designed as a one-way export from the SQLite store to Markdown.
Where is the Git remote configuration stored?
The remote URL, branch name, and commit message templates are defined in the configuration schema located at src/openhuman/config/schema/memory.rs and persisted in the user's .openhuman/config.toml file under the [gitbooks] table.
Have a question about this repo?
These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:
curl -s "https://instagit.com/install.md" Maintain an open-source project? Get it listed too →