A command-line tool for mental health professionals to generate and curate educational articles as Markdown files, formatted for Logseq or Obsidian.
This is an early-stage project. For now, content is generated by Claude and should still be reviewed before publication. This repository generates general content, and will never contain any personal information. All content is hosted on Egon Notebooks.
- uv — Python package and environment manager
- An Anthropic API key — for article text generation
- An OpenAI API key — for image generation (optional, use
--no-imageto skip)
Install uv if you don't have it:
curl -LsSf https://astral.sh/uv/install.sh | shClone the repository and install dependencies:
git clone <repo-url>
cd egon-content
uv syncCopy the example environment file and add your API keys:
cp .env.example .envOpen .env and fill in your keys:
ANTHROPIC_API_KEY=your-anthropic-key-here
OPENAI_API_KEY=your-openai-key-here # only needed for image generationGenerate a single article (with image by default):
uv run egon generate --app logseq --topic "Managing social anxiety"Output files are written to generated_content/<app>/nodes/, named after the topic title (e.g. Managing social anxiety.md).
Images are saved to generated_content/<app>/images/.
If a file already exists, you will be prompted whether to overwrite it.
Generate without an image:
uv run egon generate --app obsidian --topic "Joy" --no-imageGenerate a single pack (collection of articles):
uv run egon pack --app obsidian --pack anxiety-and-worryGenerate the full base collection (all base collection packs):
uv run egon generate-all --app logseq --no-imagePreview what would be generated without making API calls (dry run option):
uv run egon generate-all --app obsidian --dry-run
uv run egon pack --app obsidian --pack anxiety-and-worry --dry-runAnalyze the node graph of the base collection:
uv run egon graph-report --app obsidianThis prints a structural overview and saves three files under generated_content/<app>/:
| File | Contents |
|---|---|
graph-report.txt |
Numeric metrics summary |
graph-data.txt |
Full adjacency list sorted by degree |
graph-plot.png |
Network visualization |
| Metric | What it measures | Mental health interpretation |
|---|---|---|
| Nodes | Total articles | Size of the knowledge base |
| Edges | Undirected wikilink connections | Total concept relationships |
| Avg degree | Average connections per node | How well-linked topics are on average |
| Density | Edges as a fraction of all possible edges | How comprehensively the topic space is cross-linked |
| Clustering coefficient | How often a node's neighbors are also connected to each other | Reveals tight symptom/concept clusters (e.g. anxiety, worry, catastrophizing likely cluster together, which is clinically meaningful) |
| Connected components | Number of disconnected sub-graphs | A value > 1 means some topic areas are unreachable by wikilink navigation — a gap to address |
| Orphan nodes | Nodes with no connections | Articles that exist in isolation and won't be discovered by following links |
| Most linked (top 10) | Nodes with highest undirected degree | The anchor concepts of the knowledge base — most referenced, most visited |
| Betweenness centrality (top 5) | How often a node lies on the shortest path between two others | Bridge concepts — topics that connect different clusters (e.g. Emotion regulation may bridge anxiety and depression clusters). These articles are load-bearing: removing them fragments the graph |
The graph is a directed simple graph (DiGraph) — edges reflect wikilinks written into article bodies. Metrics are computed on the undirected projection. Edges are unweighted; self-loops are excluded.
Install clinically validated questionnaire templates:
uv run egon install-questionnaires --app obsidianWrites one Markdown template per questionnaire to generated_content/<app>/nodes/.
No API call is made — content is exact and static.
Existing files are left untouched.
The following instruments are included (all open-license):
| Instrument | Full name | Measures |
|---|---|---|
| PHQ-9 | Patient Health Questionnaire-9 | Depression |
| GAD-7 | Generalized Anxiety Disorder-7 | Generalized anxiety |
| WHO-5 | WHO Five Well-Being Index | Subjective wellbeing |
| PSS-10 | Perceived Stress Scale | Perceived stress |
| RSES | Rosenberg Self-Esteem Scale | Global self-esteem |
| BRS | Brief Resilience Scale | Resilience |
Each template is formatted for use as a monthly journal entry — questions are listed with response options and a score field, followed by a scoring guide and interpretation table.
List all available packs and topics:
uv run egon list-packsEach node is a Markdown file containing:
- Metadata — author, date, tags, and aliases in the format native to each app
- Article body — ~300 words of accessible, evidence-informed prose written in American English, following AFSP and SAMHSA safe messaging guidelines
- Inline wikilinks — topic titles and their aliases found in the body text are automatically wrapped in
[[...]], so the graph is connected out of the box - Illustration — a 1200×675 WebP image generated by DALL-E 3 in a soft watercolor style (skippable with
--no-image) - Disclaimer — noting that the content has not yet been reviewed by a human expert
- Edit
prompts/article_system.txtto change the writing style or safe messaging instructions - Edit
prompts/image_style.txtto change the illustration style
Open egon/packs.py and add a new pack key with a list of topic strings, or append topics to an existing pack.
Run uv run egon generate-all to generate the new content.
Open egon/linker.py and add entries to the TOPIC_ALIASES dictionary.
Aliases appear in the node's metadata and are also matched when injecting wikilinks into body text.
- Generate files with
--app logseq - Copy
.mdfiles fromgenerated_content/logseq/nodes/into thepages/folder of your Logseq graph - Copy images from
generated_content/logseq/assets/into theassets/folder of your graph - Logseq detects both immediately — no import step needed
- Open each page to review and edit before publishing
- Generate files with
--app obsidian - Copy
.mdfiles fromgenerated_content/obsidian/nodes/into your Obsidian vault - Copy images from
generated_content/obsidian/images/into the same vault folder - Obsidian detects the files immediately — no import step needed
- Open each note to review and edit before publishing
egon/
├── cli.py # CLI entry point (generate, pack, generate-all, graph-report,
│ # install-questionnaires, list-packs)
├── packs.py # Topic pack definitions (BASE_PACKS controls the base graph)
├── prompts.py # Prompt loading and response parsing
├── linker.py # Inline wikilink injection and alias definitions
├── graph.py # Node graph analysis, metrics, and visualization
├── image_generator.py # DALL-E 3 image generation
├── questionnaire_data.py # Structured definitions for all validated questionnaires
├── questionnaire_formatter.py # Renders questionnaire data to Obsidian / Logseq Markdown
└── generators/
├── __init__.py # Shared filename utility
├── obsidian.py # Obsidian Markdown formatter
└── logseq.py # Logseq Markdown formatter
prompts/
├── article_system.txt # Claude system prompt (edit to change writing style)
└── image_style.txt # DALL-E image style instructions (edit to change illustration style)
tests/
├── test_cli.py
├── test_generators.py
├── test_graph.py
├── test_image_generator.py
└── test_questionnaires.py
The current focus is Logseq and Obsidian. Once the concept is proven, the following may be added:
- Zettlr — academic/research focus, Zettelkasten methodology, Pandoc export
- Dendron — Markdown-based, lives inside VS Code as an extension
- SiYuan — block-based like Logseq, self-hostable
- Anytype — local-first, peer-to-peer architecture
- Reflect
- Include templates for journaling options (e.g. prompting a reflection question)
- Include self-assessment nodes (e.g. dimensional mood/anxiety scales)
