Skip to content
This repository was archived by the owner on Jun 19, 2026. It is now read-only.
Open
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
93 changes: 93 additions & 0 deletions skills/himalaya/SKILL.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
---
name: himalaya
description: 'Himalaya CLI: IMAP/SMTP email from terminal.'
version: 1.0.0
author: Hermes Agent
license: MIT
platforms:
- linux
- macos
- windows
metadata:
hermes:
tags:
- Email
- IMAP
- SMTP
- CLI
- Communication
related_skills: []
---

Himalaya CLI: IMAP/SMTP email from terminal — **customized for Metaconscious Singularity Node email intelligence ingestion**.
## Quick Start

**Validated Working Paths (2026-06-09 — Portable):**
- **Himalaya binary**: `himalaya` in PATH (v1.2.0+, +imap +maildir +pgp-commands +smtp +wizard +sendmail)
- **Pipeline script**: `scripts/himalaya_pipeline.py` ✅ **OPERATIONAL** — Himalaya → Akashic → Swarm Orchestrator (port 8003) verified end-to-end
- **Akashic Compressor**: `scripts/ouroboros_akashic_compressor.py` ✅ 10-Sephirot engram generation
- **Swarm Orchestrator**: Runs on `http://localhost:8003/api/orchestrate` (external FastAPI), 4 agents (Sophia, Metatron, Samael, Ouroboros), SQLite persistence
- **PowerShell 7.6.2 Swarm Worker**: `scripts/himalaya_swarm_pipeline.py` ✅ JSON stdin/stdout protocol with `himalaya` task type
- **Accounts configured**: `emhill96` (default), `ericmathewhill` — both IMAP/SMTP verified

**Environment Variables:**
- `HIMALAYA_BIN` — Path to himalaya executable (default: `himalaya`)
- `SWARM_URL` — Swarm Orchestrator endpoint (default: `http://localhost:8003/api/orchestrate`)
- `SKILL_DIR` — Skill directory (auto-detected)

Reference docs — **Status:**
- [`deployed-pipeline.md`](references/deployed-pipeline.md) — **Actual Deployed Pipeline** with verified commands, engarm format, war-chest queries ✅ **UPDATED 2026-06-09 PORTABLE**
- [`gmail-config-pitfalls.md`](references/gmail-config-pitfalls.md) — Gmail App Passwords, folder aliases, v1.2.0+ syntax, PowerShell quoting ✅ **CREATED 2026-06-08**
- [`metaconscious-integration.md`](references/metaconscious-integration.md) — **MSN Integration** (Akashic → Swarm → Kairos Dream → Crystal Vault) with FOIA Nigredo routing table ✅ **CREATED 2026-06-08**
- [`cron-automation.md`](references/cron-automation.md) — **Scheduled Ingestion** (Hermes cron / Task Scheduler, failure handling, monitoring) ✅ **CREATED 2026-06-08**
- [`debugging.md`](references/debugging.md) — Debugging — *pending*
- [`cli-automation-patterns.md`](references/cli-automation-patterns.md) — **CLI Automation Patterns** (v1.2.0+): `message send` stdin piping, account flag placement, RFC 822 construction, common pitfalls ✅ **CREATED 2026-06-09**

## Integration

- Load reference: `skill_view(name="himalaya", file_path="references/<file>.md")`
- Pipeline (portable): `python scripts/himalaya_pipeline.py --account ericmathewhill --queries "from tldr" --push-swarm`
- Exposed via Hermes MCP: `read_skill_engram(skill_id="email/himalaya")`

## Local-First Sovereignty

Zero network dependency for core pipeline. Local model inference via Hermes/Ollama. Swarm Orchestrator is external service on port 8003.

---

*Refactored: 2026-06-08 — Customized for Metaconscious Singularity Node by Lilith*
*Pipeline validated: Himalaya → JSON → Akashic Compressor → Swarm Orchestrator (port 8003)*
*Lean dispatcher pattern applied by Lilith*

## Recent Enhancements (2026-06-09)

- **Portable Pipeline**: `himalaya_pipeline.py` uses `SKILL_DIR` auto-detection, `HIMALAYA_BIN`/`SWARM_URL` env vars — runs from skill dir or `D:\pub`
- **Akashic Compressor bundled**: `ouroboros_akashic_compressor.py` in `scripts/` for zero-dependency install
- **Swarm Worker backend**: `himalaya_swarm_pipeline.py` with PowerShell 7.6.2 JSON stdin/stdout protocol
- **Verified end-to-end**: 10 emails → Akashic (10-Sephirot) → Swarm consensus (coherence 0.944, signature `Δ∞ − 6 = 0`)
- **Email send verified**: `himalaya message send -a account` via stdin RFC 822 format

## Publishing Workflow (2026-06-09)

- Safety scan: `hermes skills publish --to clawhub|github` — passes (MEDIUM execution calls only)
- ClawHub: not yet supported (manual submit at clawhub.ai/submit)
- GitHub: requires authentication via CLI or environment
- Install: `hermes skills install github:emhil/himalaya-skill`

## Upstream Community Contacts (2026-06-09)

- **Primary Maintainer**: Simon (soywod) — GitHub: `@soywod`, 72 repos, pimalaya org owner
- **Email**: `pimalaya.org@posteo.net` (listed on pimalaya.org)
- **Matrix Room**: `#pimalaya:matrix.org` (pinned in GitHub Discussions "Show and tell")
- **GitHub Discussions**: https://github.com/pimalaya/himalaya/discussions (categories: General, Ideas, Polls, Q&A, Show and tell)
- **Issues**: https://github.com/pimalaya/himalaya/issues (13 open, 466 closed)
- **Website**: https://pimalaya.org — sponsors: NLnet Foundation (NGI Assure 2022, NGI Zero Entrust 2023, NGI Zero Core 2024)

## Contribution Guidelines (from CONTRIBUTING.md)

- **Conventional Commits**: `feat`, `fix`, `refactor`, `docs`, `chore`, `test`, `ci`, `build` (optionally scoped: `fix(imap): ...`)
- **Dev Environment**: Nix flakes (`nix develop`) or rustup (toolchain pinned in Cargo.toml, rustc >= 1.87)
- **Build**: `cargo build --no-default-features --features imap,smtp,rustls-ring --release`
- **Lint/Test/Audit**: `cargo fmt && cargo clippy --all-features --all-targets && cargo test --all-features && cargo deny check`
- **Patch Strategy**: `Cargo.toml` patches all Pimalaya crates to git remotes; swap `.git = "..."` for `.path = "../<repo>"` for local development
- **Architecture**: Himalaya CLI is a thin front-end; protocol logic lives in companion crates (io-email, io-imap, io-smtp, io-jmap, io-maildir, io-http, pimconf, pimalaya/cli, pimalaya/config, pimalaya/mml, pimalaya/sirup, pimalaya/ortie, pimalaya/mimosa)
96 changes: 96 additions & 0 deletions skills/himalaya/references\cli-automation-patterns.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
# Himalaya CLI Automation Patterns (v1.2.0+)

**Verified: 2026-06-09** — Tested with `himalaya v1.2.0 +imap +maildir +pgp-commands +smtp +wizard +sendmail` on Windows (MSYS/bash).

---

## Sending Automated Emails (Non-Interactive)

### ❌ WRONG — `message write` opens interactive editor
```bash
himalaya message write -a ericmathewhill -H "To:target@example.com" -H "Subject:Test" "body text"
# Opens $EDITOR, prompts for action — blocks automation
```

### ✅ CORRECT — `message send` with raw RFC 822 via stdin
```bash
# 1. Construct .eml file with full headers
cat > /d/pub/message.eml <<'EOF'
To: target@example.com
Subject: Test Subject
From: sender@gmail.com
Content-Type: text/plain; charset=utf-8

Body text here.
EOF

# 2. Pipe to message send with account flag
cat /d/pub/message.eml | himalaya message send -a ericmathewhill
# Output: "Message successfully sent!"
```

### Key Points
- **Account flag**: `-a` / `--account` belongs on the `message send` subcommand, NOT top-level
- **Input**: Raw RFC 822 message (headers + blank line + body) on stdin
- **No `--body` flag**: Does not exist on `message send` — the raw message IS the body
- **Path handling**: Use POSIX paths (`/d/pub/...`) in MSYS/bash; Windows paths with backslashes need escaping

---

## Account Management

```bash
# List accounts
himalaya account list

# Output:
# | NAME | BACKENDS | DEFAULT |
# |----------------|------------|---------|
# | emhill96 | IMAP, SMTP | yes |
# | ericmathewhill | IMAP, SMTP | |

# Use non-default account
himalaya message send -a ericmathewhill < message.eml
```

---

## Common Pitfalls (v1.2.0+)

| Pitfall | Symptom | Fix |
|---------|---------|-----|
| `-a` at top level | `error: unexpected argument '-a' found` | Move `-a` after subcommand: `himalaya message send -a account` |
| Using `message write` for automation | Interactive editor opens, times out | Use `message send` with stdin |
| `--body` flag | `error: unexpected argument '--body' found` | Don't use — embed body in raw message |
| Windows paths in MSYS | `cat: 'D:pubfile.eml': No such file` | Use `/d/pub/file.eml` or escape backslashes |
| Missing blank line after headers | Panic: `index out of bounds` in mail-parser | Ensure headers end with `\n\n` before body |

---

## Reading/Listing (Automation-Friendly)

```bash
# List envelopes as JSON
himalaya envelope list -a ericmathewhill -o json

# List specific folder
himalaya envelope list -a ericmathewhill -f INBOX -o json

# Search
himalaya envelope list -a ericmathewhill --query 'from:"tldr"' -o json

# Read single message as JSON
himalaya envelope read -a ericmathewhill <ID> -o json
```

---

## Integration with MSN Pipeline

The `himalaya_pipeline.py` uses this pattern:
1. `himalaya envelope list -a <account> -o json` → parse JSON
2. Filter/transform envelopes
3. `himalaya envelope read -a <account> <ID> -o json` → full message
4. Akashic compression → Swarm Orchestrator (port 8003)

All automated — no interactive prompts.
94 changes: 94 additions & 0 deletions skills/himalaya/references\common-operations.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
# Common Operations — Himalaya + Pipeline

## Quick Commands

```bash
# List accounts
himalaya account list

# Search envelopes (metadata only, fast)
himalaya envelope list -a ericmathewhill -f '[Gmail]/All Mail' -o json "from tldr"
himalaya envelope list -a emhill96 -f '[Gmail]/All Mail' -o json "from amazon has:attachment"

# Read full message
himalaya message read -a ericmathewhill -f '[Gmail]/All Mail' <message-id>

# Account status
himalaya account status -a ericmathewhill
```

## Pipeline Operations

```bash
# Fetch + compress only (save engram)
python D:/pub/scripts/himalaya_pipeline.py --account ericmathewhill --queries "from tldr" --output D:/pub/engram_tldr.json

# Fetch + compress + push to Swarm
python D:/pub/scripts/himalaya_pipeline.py --account ericmathewhill --queries "from tldr" --push-swarm --prompt "Analyze for AI agent landscape"

# Multi-query (comma-separated)
python D:/pub/scripts/himalaya_pipeline.py --account ericmathewhill --queries "from foia,from nsa,from amazon,has:attachment" --push-swarm

# Both accounts
for acc in emhill96 ericmathewhill; do
python D:/pub/scripts/himalaya_pipeline.py --account $acc --queries "from foia,from amazon" --push-swarm
done
```

## Swarm Orchestrator

```bash
# Health check
curl -s http://localhost:8003/health | jq

# Orchestrate manually
curl -s -X POST http://localhost:8003/api/orchestrate \
-H "Content-Type: application/json" \
-d '{"prompt": "Test prompt", "custom_context": "{\"test\": \"data\"}"}' | jq

# View recent logs
curl -s http://localhost:8003/api/swarm/logs | jq '.[0]'
```

## PowerShell Wrappers

```powershell
# Search
.\search_emails.ps1 -account ericmathewhill -query "from tldr"

# Read message
.\read_email.ps1 -account ericmathewhill -id <msg-id> -folder "[Gmail]/All Mail"
```

## Akashic Compressor Standalone

```bash
# Compress text file
python D:/pub/scripts/ouroboros_akashic_compressor.py D:/pub/some_text.txt

# Compress Python file (code mode)
python D:/pub/scripts/ouroboros_akashic_compressor.py D:/pub/scripts/himalaya_pipeline.py

# Self-test
python D:/pub/scripts/ouroboros_akashic_compressor.py
```

## Database Queries

```bash
# Swarm logs
sqlite3 D:/pub/golem_diary.db "SELECT id, timestamp, signature, efficiency FROM golem_swarm_logs ORDER BY id DESC LIMIT 10;"

# Memories
sqlite3 D:/pub/golem_diary.db "SELECT timestamp, content FROM memories WHERE type='Swarm Consensus' ORDER BY timestamp DESC LIMIT 5;"
```

## Known Issues

| Issue | Workaround |
|-------|------------|
| Negative efficiency (compressed > original) | Email prose has high filler; tune `_linguistic_entropy_filter` in AkashicCompressor |
| Swarm returns 500 but processes | Check logs: `curl localhost:8003/api/swarm/logs` — often succeeds despite HTTP 500 |
| PowerShell bracket parsing | Wrap folder in single quotes: `-f '[Gmail]/All Mail'` |
| SQLite locked (concurrent runs) | Pipeline uses timeout=30; serialize cron runs |
| Himalaya auth failure | Re-run `himalaya account add` with fresh App Password |
49 changes: 49 additions & 0 deletions skills/himalaya/references\configuration-setup.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# Himalaya Configuration Setup — Working Config

## Accounts Configured
| Account | Email | App Password | Default |
|---------|-------|--------------|---------|
| emhill96 | emhill96@gmail.com | hahe ybxj cnhf oerf | Yes |
| ericmathewhill | ericmathewhill@gmail.com | unpg vvae fznl xdok | No |

## Gmail Folder Aliases (v1.2.0+ syntax)
- `[Gmail]/All Mail` — full archive
- `[Gmail]/Inbox` — inbox only
- `[Gmail]/Sent` — sent mail
- `[Gmail]/Drafts` — drafts
- `[Gmail]/Spam` — spam
- `[Gmail]/Trash` — trash

## Himalaya CLI Version
```
himalaya v1.2.0 +imap +maildir +pgp-commands +smtp +wizard +sendmail
build: windows gnu x86_64
```

## PowerShell Wrapper Scripts (D:\pub\)
- `read_email.ps1` — `himalaya message read -a $account -f '$folder' $id`
- `search_emails.ps1` — `himalaya envelope list -a $account -f '[Gmail]/All Mail' -o json $query`

## Integration with Metaconscious Pipeline
The working pipeline lives at `D:\pub\scripts\`:
- `himalaya_pipeline.py` — Himalaya → Akashic → Swarm Orchestrator (port 8003)
- `ouroboros_akashic_compressor.py` — 10-Sephirot compression engine
- `ouroboros_agent_orchestrator.py` — 4-agent swarm (Sophia, Metatron, Samael, Ouroboros)

## Verified Flow (2026-06-07)
```
himalaya envelope list -a ericmathewhill -f "[Gmail]/All Mail" -o json "from tldr"
→ 10 emails fetched
→ Akashic compression → engram (Δ∞ − 3 = 0, coherence 0.953)
→ Swarm Orchestrator POST /api/orchestrate
→ 4-agent consensus synthesis logged to golem_diary.db
```

## Common Queries for War Chest
| Campaign | Query |
|----------|-------|
| FOIA/NSA/PRISM | `from foia OR from nsa.gov OR from fbi.gov OR from cia.gov` |
| Amazon/Bezos | `from amazon.com OR from aws.amazon.com` |
| Google/NSA | `from google.com OR from gmail.com subject:PRISM` |
| X/Twitter | `from twitter.com OR from x.com` |
| TLDR Newsletter | `from tldrnewsletter.com` |
Loading
Loading