alfard 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (123) hide show
  1. alfard-0.1.0/.env.example +20 -0
  2. alfard-0.1.0/.gitignore +71 -0
  3. alfard-0.1.0/LICENSE +21 -0
  4. alfard-0.1.0/PKG-INFO +326 -0
  5. alfard-0.1.0/README.md +293 -0
  6. alfard-0.1.0/agents/.gitkeep +0 -0
  7. alfard-0.1.0/alfard/__init__.py +1 -0
  8. alfard-0.1.0/alfard/agents/__init__.py +0 -0
  9. alfard-0.1.0/alfard/agents/base_prompt.py +47 -0
  10. alfard-0.1.0/alfard/agents/loader.py +189 -0
  11. alfard-0.1.0/alfard/assets/banner.txt +6 -0
  12. alfard-0.1.0/alfard/audit/__init__.py +1 -0
  13. alfard-0.1.0/alfard/audit/logger.py +130 -0
  14. alfard-0.1.0/alfard/channels/__init__.py +1 -0
  15. alfard-0.1.0/alfard/channels/base.py +27 -0
  16. alfard-0.1.0/alfard/channels/discord.py +28 -0
  17. alfard-0.1.0/alfard/channels/manager.py +78 -0
  18. alfard-0.1.0/alfard/channels/slack.py +33 -0
  19. alfard-0.1.0/alfard/channels/telegram.py +28 -0
  20. alfard-0.1.0/alfard/channels/terminal.py +329 -0
  21. alfard-0.1.0/alfard/cli/__init__.py +0 -0
  22. alfard-0.1.0/alfard/cli/cmd_channel.py +368 -0
  23. alfard-0.1.0/alfard/cli/cmd_connect.py +584 -0
  24. alfard-0.1.0/alfard/cli/cmd_create.py +293 -0
  25. alfard-0.1.0/alfard/cli/cmd_cron.py +594 -0
  26. alfard-0.1.0/alfard/cli/cmd_disconnect.py +174 -0
  27. alfard-0.1.0/alfard/cli/cmd_edit.py +93 -0
  28. alfard-0.1.0/alfard/cli/cmd_headless.py +196 -0
  29. alfard-0.1.0/alfard/cli/cmd_list.py +71 -0
  30. alfard-0.1.0/alfard/cli/cmd_log.py +167 -0
  31. alfard-0.1.0/alfard/cli/cmd_memory.py +300 -0
  32. alfard-0.1.0/alfard/cli/cmd_mount.py +375 -0
  33. alfard-0.1.0/alfard/cli/cmd_run.py +185 -0
  34. alfard-0.1.0/alfard/cli/cmd_service.py +194 -0
  35. alfard-0.1.0/alfard/cli/cmd_setup.py +14 -0
  36. alfard-0.1.0/alfard/cli/cmd_skill.py +290 -0
  37. alfard-0.1.0/alfard/cli/cmd_slack.py +14 -0
  38. alfard-0.1.0/alfard/cli/cmd_status.py +130 -0
  39. alfard-0.1.0/alfard/cli/components.py +532 -0
  40. alfard-0.1.0/alfard/cli/help_formatter.py +41 -0
  41. alfard-0.1.0/alfard/cli/main.py +274 -0
  42. alfard-0.1.0/alfard/cli/theme.py +165 -0
  43. alfard-0.1.0/alfard/cli/ui_helpers.py +1 -0
  44. alfard-0.1.0/alfard/commands/__init__.py +0 -0
  45. alfard-0.1.0/alfard/commands/handlers.py +184 -0
  46. alfard-0.1.0/alfard/commands/registry.py +38 -0
  47. alfard-0.1.0/alfard/cron/__init__.py +0 -0
  48. alfard-0.1.0/alfard/cron/parser.py +50 -0
  49. alfard-0.1.0/alfard/cron/runner.py +98 -0
  50. alfard-0.1.0/alfard/cron/scheduler.py +74 -0
  51. alfard-0.1.0/alfard/gate/__init__.py +1 -0
  52. alfard-0.1.0/alfard/gate/approval.py +78 -0
  53. alfard-0.1.0/alfard/integrations/__init__.py +1 -0
  54. alfard-0.1.0/alfard/integrations/catalogue.py +184 -0
  55. alfard-0.1.0/alfard/integrations/credentials.py +40 -0
  56. alfard-0.1.0/alfard/integrations/gws_tools.py +189 -0
  57. alfard-0.1.0/alfard/integrations/mcp_client.py +205 -0
  58. alfard-0.1.0/alfard/interfaces/__init__.py +0 -0
  59. alfard-0.1.0/alfard/interfaces/discord_bot.py +331 -0
  60. alfard-0.1.0/alfard/interfaces/discord_notifier.py +86 -0
  61. alfard-0.1.0/alfard/interfaces/slack_bot.py +383 -0
  62. alfard-0.1.0/alfard/interfaces/slack_notifier.py +109 -0
  63. alfard-0.1.0/alfard/interfaces/telegram_bot.py +355 -0
  64. alfard-0.1.0/alfard/interfaces/telegram_notifier.py +69 -0
  65. alfard-0.1.0/alfard/llm/__init__.py +1 -0
  66. alfard-0.1.0/alfard/llm/adapters/__init__.py +1 -0
  67. alfard-0.1.0/alfard/llm/adapters/anthropic_adapter.py +39 -0
  68. alfard-0.1.0/alfard/llm/adapters/openai_compat.py +48 -0
  69. alfard-0.1.0/alfard/llm/client.py +56 -0
  70. alfard-0.1.0/alfard/llm/providers.py +41 -0
  71. alfard-0.1.0/alfard/memory/__init__.py +0 -0
  72. alfard-0.1.0/alfard/memory/embedder.py +79 -0
  73. alfard-0.1.0/alfard/memory/manager.py +738 -0
  74. alfard-0.1.0/alfard/memory/notifications.py +31 -0
  75. alfard-0.1.0/alfard/memory/reflect_triggers.py +103 -0
  76. alfard-0.1.0/alfard/memory/store.py +320 -0
  77. alfard-0.1.0/alfard/memory/tools.py +190 -0
  78. alfard-0.1.0/alfard/mounts/__init__.py +0 -0
  79. alfard-0.1.0/alfard/mounts/manager.py +114 -0
  80. alfard-0.1.0/alfard/mounts/tools.py +189 -0
  81. alfard-0.1.0/alfard/orchestrator/__init__.py +1 -0
  82. alfard-0.1.0/alfard/orchestrator/builder.py +94 -0
  83. alfard-0.1.0/alfard/orchestrator/memory.py +49 -0
  84. alfard-0.1.0/alfard/orchestrator/orchestrator.py +274 -0
  85. alfard-0.1.0/alfard/paths.py +37 -0
  86. alfard-0.1.0/alfard/sandbox/__init__.py +1 -0
  87. alfard-0.1.0/alfard/sandbox/executor.py +42 -0
  88. alfard-0.1.0/alfard/security/__init__.py +1 -0
  89. alfard-0.1.0/alfard/security/keystore.py +169 -0
  90. alfard-0.1.0/alfard/setup/__init__.py +0 -0
  91. alfard-0.1.0/alfard/setup/dependencies.py +132 -0
  92. alfard-0.1.0/alfard/tools/__init__.py +1 -0
  93. alfard-0.1.0/alfard/tools/classifier.py +11 -0
  94. alfard-0.1.0/alfard/tools/registry.py +54 -0
  95. alfard-0.1.0/alfard/tools/sanitizer.py +38 -0
  96. alfard-0.1.0/alfard/web/__init__.py +1 -0
  97. alfard-0.1.0/alfard/web/config.py +60 -0
  98. alfard-0.1.0/alfard/web/tools.py +133 -0
  99. alfard-0.1.0/alfard/worktree/__init__.py +1 -0
  100. alfard-0.1.0/alfard/worktree/manager.py +78 -0
  101. alfard-0.1.0/assets/approval-gate.gif +0 -0
  102. alfard-0.1.0/assets/memory-flow.png +0 -0
  103. alfard-0.1.0/assets/memory-notification.png +0 -0
  104. alfard-0.1.0/assets/menu.png +0 -0
  105. alfard-0.1.0/config/integrations.yaml +1 -0
  106. alfard-0.1.0/config/tools.yaml +18 -0
  107. alfard-0.1.0/pyproject.toml +49 -0
  108. alfard-0.1.0/setup_alfard.py +773 -0
  109. alfard-0.1.0/skills/communication.md +21 -0
  110. alfard-0.1.0/skills/debugging.md +25 -0
  111. alfard-0.1.0/skills/files.md +27 -0
  112. alfard-0.1.0/skills/gdrive.md +24 -0
  113. alfard-0.1.0/skills/github.md +20 -0
  114. alfard-0.1.0/skills/gmail.md +28 -0
  115. alfard-0.1.0/skills/memory.md +31 -0
  116. alfard-0.1.0/skills/notion.md +41 -0
  117. alfard-0.1.0/skills/project.md +20 -0
  118. alfard-0.1.0/skills/reasoning.md +21 -0
  119. alfard-0.1.0/skills/research.md +21 -0
  120. alfard-0.1.0/skills/slack.md +22 -0
  121. alfard-0.1.0/skills/tasks.md +21 -0
  122. alfard-0.1.0/skills/web_usage.md +14 -0
  123. alfard-0.1.0/tests/test_memory.py +488 -0
@@ -0,0 +1,20 @@
1
+ # OpenRouter
2
+ OPENROUTER_API_KEY=your_key_here
3
+
4
+ # OpenAI
5
+ OPENAI_API_KEY=your_key_here
6
+
7
+ # Anthropic
8
+ ANTHROPIC_API_KEY=your_key_here
9
+
10
+ # Ollama (no key needed)
11
+ OLLAMA_BASE_URL=http://localhost:11434
12
+
13
+ # LM Studio (no key needed)
14
+ LMSTUDIO_BASE_URL=http://localhost:1234
15
+
16
+ # Integrations
17
+ GMAIL_CREDENTIALS_JSON=
18
+ SLACK_BOT_TOKEN=
19
+ GITHUB_TOKEN=
20
+ GDRIVE_CREDENTIALS_JSON=
@@ -0,0 +1,71 @@
1
+ # Python
2
+ __pycache__/
3
+ *.py[cod]
4
+ *.pyo
5
+ *.pyd
6
+ .Python
7
+ *.egg-info/
8
+ dist/
9
+ build/
10
+ *.egg
11
+
12
+ # Environment
13
+ .env
14
+ .env.*
15
+ !.env.example
16
+
17
+ # Virtual environments
18
+ .venv/
19
+ venv/
20
+ env/
21
+
22
+ # Audit logs
23
+ *.jsonl
24
+ logs/
25
+
26
+ # Runtime config (not committed)
27
+ config/alfard.yaml
28
+
29
+ # IDE
30
+ .idea/
31
+ .vscode/
32
+ *.swp
33
+ *.swo
34
+
35
+ # macOS
36
+ .DS_Store
37
+
38
+ # Agent personal data
39
+ agents/*/brain.md
40
+ agents/*/memory.md
41
+ agents/*/crons.yaml
42
+ agents/*/cron_logs/
43
+ agents/*/skills/
44
+ agents/*/mounts.yaml
45
+
46
+ # Logs
47
+ logs/
48
+
49
+ # Keep the agents directory structure but not personal data
50
+ agents/*/soul.md
51
+
52
+ # Smoke test / dev scratch files
53
+ /main.py
54
+ /test_agent.py
55
+ /diag_web.py
56
+
57
+ # Claude Code local settings
58
+ .claude/
59
+
60
+ # Design workspace (local only)
61
+ Design/
62
+
63
+ # Agent databases
64
+ agents/**/*.db
65
+ agents/**/*.sqlite
66
+
67
+ # Setup state
68
+ config/.setup_checkpoint.yaml
69
+
70
+ # Local skill scratchpad
71
+ skills/test.md
alfard-0.1.0/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Bharat Khanna
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
alfard-0.1.0/PKG-INFO ADDED
@@ -0,0 +1,326 @@
1
+ Metadata-Version: 2.4
2
+ Name: alfard
3
+ Version: 0.1.0
4
+ Summary: Local AI agent runtime โ€” secure by default, private by design.
5
+ Project-URL: Homepage, https://github.com/waterduckpani/alfard
6
+ Project-URL: Repository, https://github.com/waterduckpani/alfard
7
+ Project-URL: Documentation, https://docs.alfard.dev
8
+ License: MIT
9
+ License-File: LICENSE
10
+ Requires-Python: >=3.11
11
+ Requires-Dist: anthropic
12
+ Requires-Dist: apscheduler>=3.10
13
+ Requires-Dist: art
14
+ Requires-Dist: click
15
+ Requires-Dist: cryptography>=42.0.0
16
+ Requires-Dist: ddgs
17
+ Requires-Dist: discord-py>=2.0
18
+ Requires-Dist: fastapi
19
+ Requires-Dist: gitpython
20
+ Requires-Dist: keyring>=25.0.0
21
+ Requires-Dist: mcp
22
+ Requires-Dist: numpy>=1.24
23
+ Requires-Dist: openai
24
+ Requires-Dist: python-dotenv
25
+ Requires-Dist: python-telegram-bot>=20.0
26
+ Requires-Dist: pyyaml
27
+ Requires-Dist: questionary
28
+ Requires-Dist: rich
29
+ Requires-Dist: slack-sdk
30
+ Requires-Dist: sqlalchemy
31
+ Requires-Dist: uvicorn
32
+ Description-Content-Type: text/markdown
33
+
34
+ <img width="1444" height="506" alt="image" src="https://github.com/user-attachments/assets/e5a59f97-2f96-48d6-84ef-4aff7a8c5cea" />
35
+
36
+
37
+ ---
38
+
39
+ ## What is Alfard?
40
+
41
+ Alfard is an open-source local AI agent runtime built around one idea: you should always know what your agent is doing, and always be able to stop it.
42
+ Every agent has a persistent typed memory that gets smarter the longer you use it โ€” ten categories, scored by relevance and importance, with a reflection cycle that proposes improvements you review before they take effect. Your credentials are encrypted at rest in your OS keychain. Every tool call, gate decision, and session event is logged. Before anything irreversible happens, Alfard stops and asks. That confirmation is recorded. Nothing runs silently, nothing leaves your machine.
43
+ Connect it to Gmail, Notion, GitHub, Linear, Telegram, Discord. Talk to it from your terminal or your phone. It's the same agent, same memory, same rules โ€” everywhere.
44
+
45
+ ---
46
+
47
+ ## What can you do with it?
48
+
49
+ **PR review pipeline**
50
+ Connect GitHub, Slack, and Notion. Set a cron job to run every hour. When a new pull request lands, your agent reads the diff, reviews the code, and posts a structured audit to your Slack โ€” what changed, what looks risky, what questions it has. You reply with a single approval. The agent creates a tracked task in your Notion board so nothing falls through.
51
+
52
+ **Client enquiry intake**
53
+ Connect Gmail and Notion. When clients send unformatted requests, your agent reads the email, extracts key details, and formats them into a clean entry. Before touching anything, it sends you an approval request in Slack with exactly what it's about to log. One confirmation and it writes the record to your Notion database โ€” client name, request type, priority, notes attached.
54
+
55
+ **Daily engineering standup brief**
56
+ Connect GitHub, Linear, and Slack. Schedule your agent at 8am every weekday. It reads all PRs opened in the last 24 hours, checks which Linear tickets moved, and posts a concise brief to your team Slack channel. Your team starts the day with context instead of a catch-up call.
57
+
58
+ **Release notes from merged PRs**
59
+ Connect GitHub and Notion. Tell your agent: *"summarise every PR merged to main since the last tag and draft release notes."* It reads the full diff history, groups changes by type โ€” features, fixes, breaking changes โ€” and drafts a structured Notion page. You review, edit freely, and publish when you're happy.
60
+
61
+ ---
62
+
63
+ ## Why Alfard?
64
+
65
+ There are other agent frameworks. Alfard is built differently โ€” security and transparency are the architecture, not features bolted on after the fact.
66
+
67
+ **You confirm every irreversible action.**
68
+ The approval gate cannot be accidentally left off. When an agent wants to send an email, close a ticket, post a message, or write to a file, execution halts and you see the full details โ€” tool name, arguments as formatted JSON, source. You type `y` or `n`. On Telegram it's an inline keyboard. On Discord it's a button embed. The decision is logged either way. The agent cannot proceed without you.
69
+
70
+ **Your credentials are encrypted, not sitting in a text file.**
71
+ API keys are stored at `~/.alfard/.env.enc`, encrypted with Fernet (AES-128-CBC + HMAC-SHA256). The encryption key lives in your OS keychain โ€” macOS Keychain, Linux Secret Service, Windows Credential Manager. If you upgrade from a version that stored keys in plaintext, Alfard migrates and deletes the plaintext file automatically on first run. Adding a new key never overwrites an existing one.
72
+
73
+ **Everything is audited.**
74
+ Every LLM call, tool execution, gate decision, and session event is written to `~/.alfard/logs/audit.jsonl` with a UTC timestamp and session ID. Every prompt injection warning is logged. Every memory proposal review is logged. Run `alfard log` to see your full history. There are no silent actions.
75
+
76
+ **Web content cannot hijack your agent.**
77
+ Three independent layers: an output sanitiser that strips injection phrases and system blocks from every tool result before it enters context; a behavioural gate that fires on any action taken after a web fetch, regardless of whether that action is reversible; and a strip safety net that catches faked Alfard UI elements injected by malicious pages before they print. All three run unconditionally.
78
+
79
+ **Agents remember โ€” and you control what they learn.**
80
+ The memory system has ten typed categories (facts, preferences, goals, project state, procedures, mistakes, tool patterns, decisions, people, constraints), each with confidence, importance, and valence. Every 20 messages, every 30 minutes idle, and every 10 sessions, Reflect analyses recent conversations and proposes memory improvements. Those proposals sit in a review queue. You approve or reject each one before it shapes how the agent behaves. Rejected proposals are permanently blocked from re-surfacing.
81
+
82
+ **It works with any LLM, including local ones.**
83
+ OpenRouter, OpenAI, Anthropic, Ollama, LM Studio โ€” switch providers at any time. Your data never has to leave your machine even for inference.
84
+
85
+ ---
86
+
87
+ ## Features
88
+
89
+ - **Interactive menu** โ€” run `alfard`, navigate everything with arrow keys. Agents, channels, integrations, skills, mounts, cron jobs, memory, settings.
90
+ - **Multi-channel** โ€” terminal, Telegram, Discord, and Slack run simultaneously from one command. Approval gate adapts per channel โ€” inline keyboard on Telegram, button embed on Discord.
91
+ - **Headless + service mode** โ€” `alfard headless <agent>` for VPS and homelab. `alfard service install <agent>` for systemd boot-time start and crash recovery.
92
+ - **Approval gate** โ€” every irreversible action, every channel. Full arguments visible. Both outcomes logged.
93
+ - **Encrypted credentials** โ€” Fernet + OS keychain. Merge-safe writes. Automatic plaintext migration.
94
+ - **Typed persistent memory** โ€” 10 categories, valenced, scored. Reflect on three triggers. `recall_memory` tool for mid-conversation queries. Human-reviewed proposals.
95
+ - **Memory notifications** โ€” after every confirmed brain.db write, a notification appears in the channel showing exactly what was remembered and as what type.
96
+ - **Default skills package** โ€” every agent ships with 7 skills: `memory`, `tasks`, `projects`, `research`, `reasoning`, `communication`, `debugging`.
97
+ - **Three-layer prompt injection protection** โ€” output sanitiser, behavioural gate, notification strip safety net.
98
+ - **Full audit trail** โ€” every event, timestamped, queryable. `llm_call`, `tool_call`, `gate_decision`, `prompt_injection_warning`, `user_correction` and more.
99
+ - **Real integrations** โ€” Notion, GitHub, Linear, Slack via MCP. Gmail and Google Drive via OAuth. Web search via DuckDuckGo, Brave, or SearXNG.
100
+ - **Skills system** โ€” markdown-defined, per-agent, composable. Add your own in `~/.alfard/skills/`.
101
+ - **Cron jobs** โ€” schedule any agent task on a timer.
102
+ - **Slash commands** โ€” `/new`, `/remember`, `/status`, `/skills`, `/reset`, `/model`, `/help` in every channel.
103
+ - **Soul wizard** โ€” 5-section guided agent creation. Produces a structured `soul.md` on first run.
104
+ - **Local web dashboard** *(v0.2)* โ€” full local UI for agents, runs, approvals, memory, integrations, and settings.
105
+
106
+ ---
107
+
108
+ ## Quick start
109
+
110
+ ### Requirements
111
+
112
+ - Python 3.11+
113
+ - Node.js โ€” required for Notion, GitHub, and Linear (MCP over stdio)
114
+ - `gws` CLI โ€” required for Gmail and Google Drive ([SETUP COMING SOON]([https://docs.alfard.dev/integrations/gmail](https://github.com/waterduckpani/alfard/blob/master/README.md)))
115
+
116
+ ### Install
117
+
118
+ ```bash
119
+ # Recommended
120
+ pipx install alfard
121
+
122
+ # From source
123
+ git clone https://github.com/waterduckpani/alfard.git
124
+ cd alfard
125
+ pip install -e .
126
+ ```
127
+
128
+ ### Setup
129
+
130
+ ```bash
131
+ alfard setup
132
+ ```
133
+
134
+ 6 steps: LLM provider and API key, integrations, your first agent, skills, cron jobs, final review. Everything written to `~/.alfard/` โ€” nothing touches the repo.
135
+
136
+ ### Launch
137
+
138
+ ```bash
139
+ alfard
140
+ ```
141
+
142
+ <img src="assets/menu.png" alt="Alfard main menu" width="420" />
143
+
144
+ ### Run your agent
145
+
146
+ ```bash
147
+ alfard run <agent-name>
148
+ ```
149
+
150
+ Alfard loads the agent's soul and memory, connects all configured channels and integrations, and starts listening. Talk to it in the terminal, or from Telegram, Discord, and Slack simultaneously.
151
+
152
+ ### Other commands
153
+
154
+ ```bash
155
+ alfard headless <agent> # channels only, no terminal โ€” VPS / homelab
156
+ alfard service install <agent> # generate systemd unit file
157
+ alfard channel connect <name> # connect a channel (Telegram / Discord / Slack)
158
+ alfard channel disconnect <name>
159
+ alfard connect <name> # connect an integration (Gmail / Notion / GitHub...)
160
+ alfard disconnect <name>
161
+ alfard log # view the full audit trail
162
+ alfard cron # manage scheduled runs
163
+ ```
164
+
165
+ Full CLI reference โ†’ [COMING SOON]([https://docs.alfard.dev/cli](https://github.com/waterduckpani/alfard/blob/master/README.md))
166
+
167
+ ---
168
+
169
+ ## Channels
170
+
171
+ | Channel | Status | Connect |
172
+ |---|---|---|
173
+ | Terminal | โœ… Built-in | Always available |
174
+ | Telegram | โœ… Stable | `alfard channel connect telegram` |
175
+ | Discord | โœ… Stable | `alfard channel connect discord` |
176
+ | Slack | โœ… Stable | `alfard channel connect slack` |
177
+
178
+ All channels run simultaneously from a single `alfard run` command. The approval gate works natively in each โ€” inline keyboard on Telegram, button embed on Discord, prompt in terminal.
179
+
180
+ ---
181
+
182
+ ## Integrations
183
+
184
+ | Integration | Status | Connect |
185
+ |---|---|---|
186
+ | Notion | โœ… Stable | `alfard connect notion` |
187
+ | GitHub | โœ… Stable | `alfard connect github` |
188
+ | Linear | โœ… Stable | `alfard connect linear` |
189
+ | Web search (DDG / Brave / SearXNG) | โœ… Stable | Enabled in setup |
190
+ | Gmail | โš ๏ธ Experimental | `alfard connect gmail` โ€” requires `gws` |
191
+ | Google Drive | โš ๏ธ Experimental | `alfard connect gdrive` โ€” requires `gws` |
192
+
193
+ ---
194
+
195
+ ## Supported LLM providers
196
+
197
+ | Provider | Local | Notes |
198
+ |---|---|---|
199
+ | OpenRouter | No | Any model on the platform, including Claude, Gemini, and open models |
200
+ | OpenAI | No | `gpt-4o`, `gpt-4o-mini`, `o3-mini`, custom |
201
+ | Anthropic | No | `claude-sonnet-4-5`, `claude-opus-4-5`, `claude-haiku-4-5`, custom |
202
+ | Ollama | Yes | `llama3.2`, `mistral`, `qwen2.5-coder`, any local model |
203
+ | LM Studio | Yes | Any model loaded in LM Studio |
204
+
205
+ ---
206
+
207
+ ## Creating an agent
208
+
209
+ Run `alfard` and choose `create a new agent`. The soul wizard walks through five sections โ€” identity, expertise, communication style, uncertainty behaviour, and optional context about you. It writes a structured `soul.md` and adds the default skills package automatically.
210
+
211
+ You can also write `soul.md` directly. It's plain markdown:
212
+
213
+ ```markdown
214
+ # postman
215
+
216
+ ## Purpose
217
+ You manage email. You read, triage, draft, and send via Gmail.
218
+ You never send without explicit user approval.
219
+
220
+ ## Personality
221
+ Efficient and direct. Summarise threads in bullet points.
222
+
223
+ ## Rules
224
+ - Always show a draft before calling gmail_send_message.
225
+ - Mark threads read only after the user confirms.
226
+ - Flag anything from investors or customers as high priority.
227
+ ```
228
+
229
+ ---
230
+
231
+ ## Memory
232
+
233
+ Alfard's memory system stores context that persists across every session โ€” not just the last conversation.
234
+
235
+ Ten typed categories: `fact` ยท `preference` ยท `goal` ยท `project_state` ยท `procedure` ยท `mistake` ยท `tool_pattern` ยท `decision` ยท `person` ยท `constraint`
236
+
237
+ Each memory has a confidence score, importance weight, and valence. Retrieval blends relevance, recency, and importance. `project_state` always surfaces first. Agents can query memory mid-conversation using the `recall_memory` tool โ€” not just at session start.
238
+
239
+ Reflect fires on three triggers โ€” every 20 messages, every 30 minutes idle, every 10 sessions โ€” and proposes improvements based on patterns it finds. You review and approve each proposal before it writes to memory. Rejected proposals never come back.
240
+
241
+ <img src="assets/memory-flow.png" alt="Alfard memory system flow" width="600" />
242
+
243
+ ### Memory notifications
244
+
245
+ After every confirmed write to `brain.db`, a notification appears in the active channel showing exactly what was remembered and as what memory type.
246
+
247
+ <img src="assets/memory-notification.png" alt="Alfard memory notification in Discord showing a preference was saved" width="480" />
248
+
249
+ On Discord it's a small embed. On Telegram it's a separate message after the agent reply. On Slack it's a muted italic follow-up. In the terminal it's a `โ•ญโ”€ remembered โ”€โ•ฎ` panel. Only fires for writes with a confirmed source โ€” never for internal housekeeping.
250
+
251
+ ---
252
+
253
+ ## Architecture
254
+
255
+ All user data lives in `~/.alfard/`:
256
+
257
+ ```
258
+ ~/.alfard/
259
+ โ”œโ”€โ”€ .env.enc # API keys โ€” Fernet-encrypted, key in OS keychain
260
+ โ”œโ”€โ”€ config/
261
+ โ”‚ โ”œโ”€โ”€ alfard.yaml # provider, model, approval gate settings
262
+ โ”‚ โ””โ”€โ”€ integrations.yaml # connected channels and integrations
263
+ โ”œโ”€โ”€ agents/
264
+ โ”‚ โ””โ”€โ”€ <name>/
265
+ โ”‚ โ”œโ”€โ”€ soul.md # agent personality and rules
266
+ โ”‚ โ”œโ”€โ”€ skills.yaml # active skills for this agent
267
+ โ”‚ โ”œโ”€โ”€ brain.db # memory store (SQLite + vectors)
268
+ โ”‚ โ”œโ”€โ”€ memory/ # embeddings + proposals.jsonl
269
+ โ”‚ โ””โ”€โ”€ crons.yaml # scheduled tasks
270
+ โ”œโ”€โ”€ skills/ # your custom skills
271
+ โ””โ”€โ”€ logs/
272
+ โ”œโ”€โ”€ audit.jsonl # full audit trail โ€” append-only
273
+ โ””โ”€โ”€ cron_jobs.sqlite
274
+ ```
275
+
276
+ Nothing is ever written to the Alfard repo directory.
277
+
278
+ ---
279
+
280
+ ## Security
281
+
282
+ Security is the architecture, not a feature layer. See [SECURITY.md](SECURITY.md) for the complete model.
283
+
284
+ - **Approval gate** on every irreversible action, across every channel โ€” cannot be bypassed
285
+ - **Encrypted credentials** at rest โ€” Fernet + OS keychain, automatic plaintext migration
286
+ - **Three-layer prompt injection protection** โ€” sanitiser, behavioural gate, strip safety net
287
+ - **Full audit trail** โ€” every event logged, credentials never in arguments
288
+ - **Memory secret blocking** โ€” API keys, tokens, and passwords blocked before any brain.db write
289
+ - **Channel allowlists** โ€” Telegram and Discord require explicit user/guild whitelists
290
+ - **No telemetry** โ€” nothing phones home
291
+
292
+ To report a vulnerability, see [SECURITY.md](SECURITY.md#responsible-disclosure). Please do not open a public issue.
293
+
294
+ ---
295
+
296
+ ## Roadmap
297
+
298
+ - [ ] Local web dashboard โ€” full local UI *(v0.2)*
299
+ - [ ] Agent-to-agent communication
300
+ - [ ] Docker opt-in sandbox for code execution
301
+ - [ ] WhatsApp channel
302
+ - [ ] Bundled Gmail OAuth โ€” no GCP setup required
303
+
304
+ Follow progress and vote on features โ†’ [GitHub Discussions](https://github.com/waterduckpani/alfard/discussions)
305
+
306
+ ---
307
+
308
+ ## Contributing
309
+
310
+ Contributions are welcome. See [CONTRIBUTING.md](CONTRIBUTING.md) for dev setup, how to add a channel or integration, running the test suite, and the PR process.
311
+
312
+ Please read the [Code of Conduct](CODE_OF_CONDUCT.md) before contributing.
313
+
314
+ ---
315
+
316
+ ## License
317
+
318
+ MIT โ€” see [LICENSE](LICENSE).
319
+
320
+ ---
321
+
322
+ <div align="center">
323
+ Built by <a href="https://github.com/waterduckpani">Bharat Khanna</a>
324
+ <br><br>
325
+ If Alfard is useful to you, a โญ on GitHub goes a long way.
326
+ </div>