Skip to main content

📓 alkham

PyPI Python 3.9+ CI License: MIT

Your AI coding sessions are full of hard-won knowledge. alkham makes sure you never lose it.

alkham automatically turns your Claude Code and Aider sessions into clean, readable Markdown notes — filed into your knowledge base while you keep coding. It's a local-first CLI and a library-first Python engine, in one package.


The Problem

Every day you solve real problems with an AI coding agent: an architecture decided, a gnarly bug traced to its root cause, a working snippet, the reasoning behind a choice. Then… it's gone.

  • It's buried in raw .jsonl / history files you'll never open again.
  • Claude Code auto-deletes transcripts after ~30 days.
  • It fades from your own memory within days.
  • So you re-solve solved problems and forget why you made past decisions.

That terminal scrollback is some of your best thinking — and it's evaporating.

The Solution

Automated knowledge capture. alkham reads the session your AI tool already wrote to disk and files a clean, chronological, human-readable note into your Markdown vault — automatically, with zero copy-paste.

pip install alkham
alkham init      # one-time: pick a folder + flavor
alkham watch     # done — now just code.
✓ Captured  2026-05-14_add-jwt-refresh_a1b2c3.md    crowdflow
✓ Captured  2026-05-14_fix-race-in-parser_d4e5f6.md  alkham

For your Second Brain — zero-touch automation

Run alkham watch once. Then forget it exists.

You code naturally in Claude Code or Aider. The moment a session wraps up, alkham quietly:

  • captures the whole conversation as a readable narrative,
  • routes it to the right project folder in your Obsidian vault,
  • links it into a per-project Map of Content (zero orphans),
  • tags it — and every one of these behaviors can be switched off if you already have your own system.

No /save. No manual export. No friction. Your vault simply fills itself with the context you'll actually want later — and it works with Obsidian or any plain Markdown folder (VS Code, Logseq, Notion, plain files).

Local and yours. No cloud, no account, no telemetry, no network calls. Plain Markdown in a folder you own.

For developers — stop writing log parsers

Under the CLI is a clean, typed engine. Point it at a messy AI log and get a structured Python object back — in two lines:

from alkham.parsers import get_parser_for

session = get_parser_for("chat_log.jsonl").parse()

session.messages        # list[Message]  — clean human / assistant turns
session.files_modified  # which files the agent touched
session.commands_run    # which commands it ran
session.model           # …and more, all typed

alkham already handles the brittle parts — multiple tools, JSONL vs Markdown dialects, malformed lines, multi-session history files — so you don't have to. It saves you hours of writing and maintaining parsers, freeing you to build custom tools or analytics on top of your AI logs (compliance, training-data curation, usage insights, your own integrations):

from pathlib import Path
from alkham.parsers import get_parser_for

# Batch-parse a directory of exported logs into clean, typed objects
for log in Path("exports").glob("*.jsonl"):
    session = get_parser_for(log).parse()
    process(session)   # feed your own pipeline

The Session dataclass is a stability commitment (additive changes only), and get_parser_for auto-detects the source — raising a typed UnknownSourceError on anything it doesn't recognize.


The multi-tool moat

alkham captures Claude Code and Aider through one pluggable engine — and adding a new tool touches only a parser module (Codex CLI and Cursor are on the roadmap). One install, every AI terminal.

Structure for free — but never forced

Behavior Toggle
Project routing features.routing
Auto Map-of-Content features.auto_moc
Frontmatter tags features.tagging
YAML frontmatter features.frontmatter
Output dialect output.flavor = obsidian | plain

Every behavior is independently switchable, so alkham fits your existing knowledge base instead of overwriting it.

CLI at a glance

Command What it does
alkham init First-run wizard (output dir, flavor, toggles)
alkham watch Background daemon — auto-capture as sessions end
alkham sync [-t FILE] [-n] Capture the latest (or a specific) session; -n dry-runs
alkham backfill [--since DATE] [--project NAME] Batch-capture your history
alkham config [--edit] Show or edit the config
alkham moc --project NAME Rebuild a project's Map of Content
alkham install-close-command Install the /close artifact-extraction prompt

Install

pip install alkham            # the CLI + library
pip install 'alkham[watch]'   # adds the background `alkham watch` daemon

Requires Python 3.9+. Tested on macOS, Linux, and Windows.

⚠️ Security — transcripts are captured verbatim. alkham does not redact. Never capture sessions containing live API keys, tokens, or other secrets — they'd be written into your notes as-is. (Path-traversal and Markdown/YAML-injection from hostile log content are sanitized, so a transcript can never corrupt your vault.)

Learn more

License

MIT © Ali Alkhamees

Metadata

Release files for alkham 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for alkham 0.2.0
File Size Uploaded Provenance Actions
alkham-0.2.0.tar.gz 53.4 kB With provenance Details for alkham-0.2.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for alkham 0.2.0
File Interpreter ABI Platform Actions
alkham-0.2.0-py3-none-any.whl Python 3 none any Details for alkham-0.2.0-py3-none-any.whl

Total release size: 81.6 kB

Release files / alkham-0.2.0.tar.gz

Download URL alkham-0.2.0.tar.gz
Size 53.4 kB
Tags Source
SHA-256 checksum
How to use checksums
040b8a262ca25b93bfcfc2ca97954d0d049daa69b617e90e6b128ecc5d5cfe25
BLAKE2b-256 checksum
How to use checksums
92eaf422504265a5c3da2665169c1bb3374120ae30d9bab4b7b8386417eaafa8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jun 4, 2026.

Transparency log

Release files / alkham-0.2.0-py3-none-any.whl

Download URL alkham-0.2.0-py3-none-any.whl
Size 28.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
50da429f548234dc3b285703d950145ade4f066de1afea88a945a2e5a0010d2d
BLAKE2b-256 checksum
How to use checksums
a0fd378e481b3c1ab549ae79e85fa2b25478874369ef1e4037465efa4be09668
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jun 4, 2026.

Transparency log

Security for alkham 0.2.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for alkham-0.2.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jun 4, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page