pythinker-ai 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 (143) hide show
  1. pythinker_ai-0.1.0/.gitignore +98 -0
  2. pythinker_ai-0.1.0/CONTRIBUTING.md +219 -0
  3. pythinker_ai-0.1.0/LICENSE +21 -0
  4. pythinker_ai-0.1.0/PKG-INFO +321 -0
  5. pythinker_ai-0.1.0/README.md +228 -0
  6. pythinker_ai-0.1.0/SECURITY.md +279 -0
  7. pythinker_ai-0.1.0/THIRD_PARTY_NOTICES.md +148 -0
  8. pythinker_ai-0.1.0/bridge/package-lock.json +1416 -0
  9. pythinker_ai-0.1.0/bridge/package.json +26 -0
  10. pythinker_ai-0.1.0/bridge/src/index.ts +56 -0
  11. pythinker_ai-0.1.0/bridge/src/server.ts +155 -0
  12. pythinker_ai-0.1.0/bridge/src/types.d.ts +3 -0
  13. pythinker_ai-0.1.0/bridge/src/whatsapp.ts +293 -0
  14. pythinker_ai-0.1.0/bridge/tsconfig.json +16 -0
  15. pythinker_ai-0.1.0/docs/README.md +34 -0
  16. pythinker_ai-0.1.0/pyproject.toml +209 -0
  17. pythinker_ai-0.1.0/pythinker/__init__.py +32 -0
  18. pythinker_ai-0.1.0/pythinker/__main__.py +8 -0
  19. pythinker_ai-0.1.0/pythinker/agent/__init__.py +20 -0
  20. pythinker_ai-0.1.0/pythinker/agent/autocompact.py +123 -0
  21. pythinker_ai-0.1.0/pythinker/agent/context.py +209 -0
  22. pythinker_ai-0.1.0/pythinker/agent/hook.py +103 -0
  23. pythinker_ai-0.1.0/pythinker/agent/loop.py +1156 -0
  24. pythinker_ai-0.1.0/pythinker/agent/memory.py +915 -0
  25. pythinker_ai-0.1.0/pythinker/agent/runner.py +987 -0
  26. pythinker_ai-0.1.0/pythinker/agent/skills.py +242 -0
  27. pythinker_ai-0.1.0/pythinker/agent/subagent.py +322 -0
  28. pythinker_ai-0.1.0/pythinker/agent/tools/__init__.py +27 -0
  29. pythinker_ai-0.1.0/pythinker/agent/tools/base.py +279 -0
  30. pythinker_ai-0.1.0/pythinker/agent/tools/cron.py +278 -0
  31. pythinker_ai-0.1.0/pythinker/agent/tools/file_state.py +119 -0
  32. pythinker_ai-0.1.0/pythinker/agent/tools/filesystem.py +907 -0
  33. pythinker_ai-0.1.0/pythinker/agent/tools/mcp.py +625 -0
  34. pythinker_ai-0.1.0/pythinker/agent/tools/message.py +127 -0
  35. pythinker_ai-0.1.0/pythinker/agent/tools/notebook.py +161 -0
  36. pythinker_ai-0.1.0/pythinker/agent/tools/registry.py +125 -0
  37. pythinker_ai-0.1.0/pythinker/agent/tools/sandbox.py +55 -0
  38. pythinker_ai-0.1.0/pythinker/agent/tools/schema.py +232 -0
  39. pythinker_ai-0.1.0/pythinker/agent/tools/search.py +555 -0
  40. pythinker_ai-0.1.0/pythinker/agent/tools/self.py +449 -0
  41. pythinker_ai-0.1.0/pythinker/agent/tools/shell.py +318 -0
  42. pythinker_ai-0.1.0/pythinker/agent/tools/spawn.py +57 -0
  43. pythinker_ai-0.1.0/pythinker/agent/tools/web.py +436 -0
  44. pythinker_ai-0.1.0/pythinker/api/__init__.py +1 -0
  45. pythinker_ai-0.1.0/pythinker/api/server.py +380 -0
  46. pythinker_ai-0.1.0/pythinker/bus/__init__.py +6 -0
  47. pythinker_ai-0.1.0/pythinker/bus/events.py +38 -0
  48. pythinker_ai-0.1.0/pythinker/bus/queue.py +44 -0
  49. pythinker_ai-0.1.0/pythinker/channels/__init__.py +6 -0
  50. pythinker_ai-0.1.0/pythinker/channels/base.py +197 -0
  51. pythinker_ai-0.1.0/pythinker/channels/discord.py +687 -0
  52. pythinker_ai-0.1.0/pythinker/channels/email.py +678 -0
  53. pythinker_ai-0.1.0/pythinker/channels/manager.py +348 -0
  54. pythinker_ai-0.1.0/pythinker/channels/matrix.py +896 -0
  55. pythinker_ai-0.1.0/pythinker/channels/msteams.py +535 -0
  56. pythinker_ai-0.1.0/pythinker/channels/registry.py +71 -0
  57. pythinker_ai-0.1.0/pythinker/channels/slack.py +464 -0
  58. pythinker_ai-0.1.0/pythinker/channels/telegram.py +1182 -0
  59. pythinker_ai-0.1.0/pythinker/channels/websocket.py +1136 -0
  60. pythinker_ai-0.1.0/pythinker/channels/whatsapp.py +357 -0
  61. pythinker_ai-0.1.0/pythinker/cli/__init__.py +1 -0
  62. pythinker_ai-0.1.0/pythinker/cli/commands.py +1507 -0
  63. pythinker_ai-0.1.0/pythinker/cli/models.py +31 -0
  64. pythinker_ai-0.1.0/pythinker/cli/onboard.py +1126 -0
  65. pythinker_ai-0.1.0/pythinker/cli/stream.py +142 -0
  66. pythinker_ai-0.1.0/pythinker/command/__init__.py +6 -0
  67. pythinker_ai-0.1.0/pythinker/command/builtin.py +347 -0
  68. pythinker_ai-0.1.0/pythinker/command/router.py +98 -0
  69. pythinker_ai-0.1.0/pythinker/config/__init__.py +32 -0
  70. pythinker_ai-0.1.0/pythinker/config/loader.py +172 -0
  71. pythinker_ai-0.1.0/pythinker/config/paths.py +62 -0
  72. pythinker_ai-0.1.0/pythinker/config/schema.py +335 -0
  73. pythinker_ai-0.1.0/pythinker/cron/__init__.py +6 -0
  74. pythinker_ai-0.1.0/pythinker/cron/service.py +557 -0
  75. pythinker_ai-0.1.0/pythinker/cron/types.py +81 -0
  76. pythinker_ai-0.1.0/pythinker/heartbeat/__init__.py +5 -0
  77. pythinker_ai-0.1.0/pythinker/heartbeat/service.py +192 -0
  78. pythinker_ai-0.1.0/pythinker/providers/__init__.py +42 -0
  79. pythinker_ai-0.1.0/pythinker/providers/anthropic_provider.py +601 -0
  80. pythinker_ai-0.1.0/pythinker/providers/azure_openai_provider.py +183 -0
  81. pythinker_ai-0.1.0/pythinker/providers/base.py +788 -0
  82. pythinker_ai-0.1.0/pythinker/providers/github_copilot_provider.py +257 -0
  83. pythinker_ai-0.1.0/pythinker/providers/openai_codex_provider.py +158 -0
  84. pythinker_ai-0.1.0/pythinker/providers/openai_compat_provider.py +1101 -0
  85. pythinker_ai-0.1.0/pythinker/providers/openai_responses/__init__.py +29 -0
  86. pythinker_ai-0.1.0/pythinker/providers/openai_responses/converters.py +110 -0
  87. pythinker_ai-0.1.0/pythinker/providers/openai_responses/parsing.py +297 -0
  88. pythinker_ai-0.1.0/pythinker/providers/registry.py +399 -0
  89. pythinker_ai-0.1.0/pythinker/providers/transcription.py +114 -0
  90. pythinker_ai-0.1.0/pythinker/pythinker.py +180 -0
  91. pythinker_ai-0.1.0/pythinker/security/__init__.py +1 -0
  92. pythinker_ai-0.1.0/pythinker/security/network.py +120 -0
  93. pythinker_ai-0.1.0/pythinker/session/__init__.py +5 -0
  94. pythinker_ai-0.1.0/pythinker/session/manager.py +448 -0
  95. pythinker_ai-0.1.0/pythinker/skills/README.md +31 -0
  96. pythinker_ai-0.1.0/pythinker/skills/clawhub/SKILL.md +53 -0
  97. pythinker_ai-0.1.0/pythinker/skills/cron/SKILL.md +57 -0
  98. pythinker_ai-0.1.0/pythinker/skills/github/SKILL.md +48 -0
  99. pythinker_ai-0.1.0/pythinker/skills/memory/SKILL.md +36 -0
  100. pythinker_ai-0.1.0/pythinker/skills/my/SKILL.md +72 -0
  101. pythinker_ai-0.1.0/pythinker/skills/my/references/examples.md +75 -0
  102. pythinker_ai-0.1.0/pythinker/skills/skill-creator/SKILL.md +374 -0
  103. pythinker_ai-0.1.0/pythinker/skills/skill-creator/scripts/init_skill.py +378 -0
  104. pythinker_ai-0.1.0/pythinker/skills/skill-creator/scripts/package_skill.py +154 -0
  105. pythinker_ai-0.1.0/pythinker/skills/skill-creator/scripts/quick_validate.py +213 -0
  106. pythinker_ai-0.1.0/pythinker/skills/summarize/SKILL.md +67 -0
  107. pythinker_ai-0.1.0/pythinker/skills/tmux/SKILL.md +121 -0
  108. pythinker_ai-0.1.0/pythinker/skills/tmux/scripts/find-sessions.sh +112 -0
  109. pythinker_ai-0.1.0/pythinker/skills/tmux/scripts/wait-for-text.sh +83 -0
  110. pythinker_ai-0.1.0/pythinker/skills/weather/SKILL.md +49 -0
  111. pythinker_ai-0.1.0/pythinker/templates/AGENTS.md +19 -0
  112. pythinker_ai-0.1.0/pythinker/templates/HEARTBEAT.md +16 -0
  113. pythinker_ai-0.1.0/pythinker/templates/SOUL.md +20 -0
  114. pythinker_ai-0.1.0/pythinker/templates/TOOLS.md +36 -0
  115. pythinker_ai-0.1.0/pythinker/templates/USER.md +49 -0
  116. pythinker_ai-0.1.0/pythinker/templates/__init__.py +0 -0
  117. pythinker_ai-0.1.0/pythinker/templates/agent/_snippets/untrusted_content.md +2 -0
  118. pythinker_ai-0.1.0/pythinker/templates/agent/consolidator_archive.md +13 -0
  119. pythinker_ai-0.1.0/pythinker/templates/agent/dream_phase1.md +40 -0
  120. pythinker_ai-0.1.0/pythinker/templates/agent/dream_phase2.md +37 -0
  121. pythinker_ai-0.1.0/pythinker/templates/agent/evaluator.md +15 -0
  122. pythinker_ai-0.1.0/pythinker/templates/agent/identity.md +32 -0
  123. pythinker_ai-0.1.0/pythinker/templates/agent/max_iterations_message.md +1 -0
  124. pythinker_ai-0.1.0/pythinker/templates/agent/platform_policy.md +10 -0
  125. pythinker_ai-0.1.0/pythinker/templates/agent/skills_section.md +6 -0
  126. pythinker_ai-0.1.0/pythinker/templates/agent/subagent_announce.md +8 -0
  127. pythinker_ai-0.1.0/pythinker/templates/agent/subagent_system.md +19 -0
  128. pythinker_ai-0.1.0/pythinker/templates/memory/MEMORY.md +23 -0
  129. pythinker_ai-0.1.0/pythinker/templates/memory/__init__.py +0 -0
  130. pythinker_ai-0.1.0/pythinker/utils/__init__.py +6 -0
  131. pythinker_ai-0.1.0/pythinker/utils/document.py +293 -0
  132. pythinker_ai-0.1.0/pythinker/utils/evaluator.py +89 -0
  133. pythinker_ai-0.1.0/pythinker/utils/gitstore.py +390 -0
  134. pythinker_ai-0.1.0/pythinker/utils/helpers.py +537 -0
  135. pythinker_ai-0.1.0/pythinker/utils/media_decode.py +55 -0
  136. pythinker_ai-0.1.0/pythinker/utils/path.py +107 -0
  137. pythinker_ai-0.1.0/pythinker/utils/prompt_templates.py +35 -0
  138. pythinker_ai-0.1.0/pythinker/utils/restart.py +58 -0
  139. pythinker_ai-0.1.0/pythinker/utils/runtime.py +97 -0
  140. pythinker_ai-0.1.0/pythinker/utils/searchusage.py +168 -0
  141. pythinker_ai-0.1.0/pythinker/utils/tool_hints.py +137 -0
  142. pythinker_ai-0.1.0/pythinker/web/__init__.py +6 -0
  143. pythinker_ai-0.1.0/webui/README.md +98 -0
@@ -0,0 +1,98 @@
1
+ # Project-specific
2
+ .worktrees/
3
+ .assets
4
+ .docs
5
+ .env
6
+ .web
7
+ .orion
8
+
9
+ # webui (monorepo frontend)
10
+ webui/node_modules/
11
+ webui/dist/
12
+ webui/coverage/
13
+ webui/.vite/
14
+ *.tsbuildinfo
15
+
16
+ # bridge (monorepo node service)
17
+ bridge/node_modules/
18
+ bridge/dist/
19
+
20
+ # Python bytecode & caches
21
+ *.pyc
22
+ *.pyo
23
+ *.pyd
24
+ *.pyw
25
+ *.pyz
26
+ __pycache__/
27
+ *.egg-info/
28
+ *.egg
29
+ .venv/
30
+ venv/
31
+ .pytest_cache/
32
+ .mypy_cache/
33
+ .ruff_cache/
34
+ .pytype/
35
+ .dmypy.json
36
+ dmypy.json
37
+ .tox/
38
+ .nox/
39
+ .hypothesis/
40
+
41
+ # Build & packaging
42
+ dist/
43
+ build/
44
+ *.manifest
45
+ *.spec
46
+ pip-wheel-metadata/
47
+ share/python-wheels/
48
+
49
+ # Test & coverage
50
+ .coverage
51
+ .coverage.*
52
+ htmlcov/
53
+ coverage.xml
54
+ *.cover
55
+
56
+ # Lock files (project policy)
57
+ poetry.lock
58
+ uv.lock
59
+
60
+ # Jupyter
61
+ .ipynb_checkpoints/
62
+
63
+ # macOS
64
+ .DS_Store
65
+ .AppleDouble
66
+ .LSOverride
67
+
68
+ # Windows
69
+ Thumbs.db
70
+ ehthumbs.db
71
+ Desktop.ini
72
+
73
+ # Linux
74
+ .directory
75
+
76
+ # Editors & IDEs (local workspace / user settings)
77
+ .vscode/
78
+ .cursor/
79
+ .idea/
80
+ .fleet/
81
+ *.code-workspace
82
+ *.sublime-project
83
+ *.sublime-workspace
84
+ *.swp
85
+ *.swo
86
+ *~
87
+ nano.*.save
88
+
89
+ # Environment & secrets (keep examples tracked if needed)
90
+ .env.*
91
+ !.env.example
92
+
93
+ # Logs & temp
94
+ *.log
95
+ logs/
96
+ tmp/
97
+ temp/
98
+ *.tmp
@@ -0,0 +1,219 @@
1
+ # Contributing to Pythinker
2
+
3
+ Thank you for being here.
4
+
5
+ Pythinker is built with a simple belief: good tools should feel calm, clear, and humane.
6
+ We care deeply about useful features, but we also believe in achieving more with less:
7
+ solutions should be powerful without becoming heavy, and ambitious without becoming
8
+ needlessly complicated.
9
+
10
+ This guide is not only about how to open a PR. It is also about how we hope to build
11
+ software together: with care, clarity, and respect for the next person reading the code.
12
+
13
+ ## Maintainers
14
+
15
+ | Maintainer | Focus |
16
+ |------------|-------|
17
+ | [@mohamed-elkholy95](https://github.com/mohamed-elkholy95) | Project lead, `main` + `dev` branches |
18
+
19
+ ## Branching Strategy
20
+
21
+ We use a two-branch model to balance stability and exploration:
22
+
23
+ | Branch | Purpose | Stability |
24
+ |--------|---------|-----------|
25
+ | `main` | Stable releases | Production-ready |
26
+ | `dev` | Experimental features | May have bugs or breaking changes |
27
+
28
+ ### Which Branch Should I Target?
29
+
30
+ **Target `dev` if your PR includes:**
31
+
32
+ - New features or functionality
33
+ - Refactoring that may affect existing behavior
34
+ - Changes to APIs or configuration
35
+
36
+ **Target `main` if your PR includes:**
37
+
38
+ - Bug fixes with no behavior changes
39
+ - Documentation improvements
40
+ - Minor tweaks that don't affect functionality
41
+
42
+ **When in doubt, target `dev`.** It is easier to move a stable idea from `dev` to `main`
43
+ than to undo a risky change after it lands in the stable branch.
44
+
45
+ ### How Does `dev` Get Merged to `main`?
46
+
47
+ We don't merge the entire `dev` branch. Instead, stable features are **cherry-picked**
48
+ from `dev` into individual PRs targeting `main`:
49
+
50
+ ```
51
+ dev โ”€โ”€โ”ฌโ”€โ”€ feature A (stable) โ”€โ”€โ–บ PR โ”€โ”€โ–บ main
52
+ โ”œโ”€โ”€ feature B (testing)
53
+ โ””โ”€โ”€ feature C (stable) โ”€โ”€โ–บ PR โ”€โ”€โ–บ main
54
+ ```
55
+
56
+ This happens on an as-needed cadence โ€” when a feature has settled and is ready for a
57
+ stable release.
58
+
59
+ ### Quick Summary
60
+
61
+ | Your Change | Target Branch |
62
+ |-------------|---------------|
63
+ | New feature | `dev` |
64
+ | Bug fix | `main` |
65
+ | Documentation | `main` |
66
+ | Refactoring | `dev` |
67
+ | Unsure | `dev` |
68
+
69
+ ## Development Setup
70
+
71
+ Keep setup boring and reliable. The goal is to get you into the code quickly.
72
+
73
+ Pythinker is a Python package (`pythinker/`) plus a Vite/React web UI (`webui/`) and a
74
+ small Node bridge for WhatsApp (`bridge/`). You only need to set up the parts you plan to
75
+ touch.
76
+
77
+ ### Python (core package)
78
+
79
+ We use [`uv`](https://docs.astral.sh/uv/) in CI because it's fast and deterministic. Plain
80
+ `pip` works too.
81
+
82
+ ```bash
83
+ # Clone the repository
84
+ git clone https://github.com/mohamed-elkholy95/Pythinker-ai.git
85
+ cd Pythinker-ai
86
+
87
+ # Recommended: uv
88
+ uv sync --all-extras
89
+
90
+ # Alternative: pip + venv
91
+ python -m venv .venv
92
+ source .venv/bin/activate # Windows: .venv\Scripts\activate
93
+ pip install -e ".[dev]"
94
+
95
+ # Run tests
96
+ uv run pytest tests/
97
+ # or: pytest tests/
98
+
99
+ # Lint
100
+ uv run ruff check pythinker
101
+ # or: ruff check pythinker
102
+
103
+ # Format
104
+ uv run ruff format pythinker
105
+ # or: ruff format pythinker
106
+ ```
107
+
108
+ `pyproject.toml` is the source of truth for dependencies, lint rules, and test
109
+ configuration. If you're unsure which extras to install, `--all-extras` / `[dev]` covers
110
+ the full development surface.
111
+
112
+ ### Web UI
113
+
114
+ The WebUI lives in `webui/` and uses [Bun](https://bun.sh/) (lockfile: `bun.lock`). `npm`
115
+ also works, but please do not commit npm or pnpm lockfiles alongside `bun.lock`.
116
+
117
+ ```bash
118
+ cd webui
119
+ bun install
120
+ bun run dev # local dev server
121
+ bun run test # vitest
122
+ bun run build # production bundle
123
+ ```
124
+
125
+ ### Node bridge (WhatsApp)
126
+
127
+ The `bridge/` directory is only needed if you're working on the WhatsApp channel.
128
+
129
+ ```bash
130
+ cd bridge
131
+ npm install
132
+ npm run build
133
+ ```
134
+
135
+ ## Code Style
136
+
137
+ We care about more than passing lint. We want Pythinker to stay small, calm, and readable.
138
+
139
+ When contributing, please aim for code that feels:
140
+
141
+ - **Simple** โ€” prefer the smallest change that solves the real problem.
142
+ - **Clear** โ€” optimize for the next reader, not for cleverness.
143
+ - **Decoupled** โ€” keep boundaries clean and avoid unnecessary new abstractions.
144
+ - **Honest** โ€” do not hide complexity, but do not create extra complexity either.
145
+ - **Durable** โ€” choose solutions that are easy to maintain, test, and extend.
146
+
147
+ ### Python
148
+
149
+ - **Line length**: 100 characters (enforced by `ruff`; `E501` is ignored so long strings
150
+ and comments don't block you, but treat 100 as a target).
151
+ - **Target**: Python 3.11+. CI tests 3.11, 3.12, 3.13, and 3.14 on Ubuntu and Windows.
152
+ - **Linting**: `ruff` with rule groups `E, F, I, N, W` (see `[tool.ruff.lint]` in
153
+ `pyproject.toml`). CI is strictest about `F401` (unused imports) and `F841` (unused
154
+ variables) โ€” please clean those before opening a PR.
155
+ - **Typing**: Python is dynamically typed, but we prefer annotations on public functions,
156
+ dataclasses, and anything on the message bus / tool registry boundary.
157
+ - **Async**: the codebase is `asyncio`-native. `pytest` is configured with
158
+ `asyncio_mode = "auto"`, so `async def test_โ€ฆ` functions run as coroutines automatically.
159
+ - **Logging**: use `loguru` (`from loguru import logger`), not the stdlib `logging` module.
160
+ - **Formatting**: `ruff format` is available but not enforced in CI. Match the surrounding
161
+ file when in doubt.
162
+
163
+ ### TypeScript / React (webui)
164
+
165
+ - Uses Vite + TypeScript 5.7 + Tailwind + Radix UI. Keep components small, typed, and
166
+ colocated with the feature they serve.
167
+ - Tests use Vitest + Testing Library. Put tests in `webui/src/tests/` or next to the unit.
168
+ - Match the existing import style and file naming. Prefer functional components and hooks.
169
+
170
+ ### Node (bridge)
171
+
172
+ - TypeScript, compiled via `tsc`. Keep the bridge as thin as possible โ€” it's a relay, not
173
+ a second runtime.
174
+
175
+ ### In practice
176
+
177
+ - Prefer readable code over magical code.
178
+ - Prefer focused patches over broad rewrites.
179
+ - If a new abstraction is introduced, it should clearly reduce complexity rather than
180
+ move it around.
181
+ - Do not add drive-by reformatting to unrelated files; it makes review harder.
182
+
183
+ ## Tests
184
+
185
+ - Python tests live under `tests/`, organized by subsystem (`tests/agent/`,
186
+ `tests/channels/`, `tests/providers/`, etc.). New behavior needs a test; bug fixes
187
+ should include a test that fails before the fix and passes after.
188
+ - Web UI tests live under `webui/src/tests/` and run with `bun run test`.
189
+ - CI runs `ruff check pythinker --select F401,F841` and `pytest tests/` across the Python
190
+ matrix. Please make sure both pass locally before opening a PR.
191
+
192
+ ## Commits and Pull Requests
193
+
194
+ - **Commit messages**: imperative mood, short subject (โ‰ค72 characters). The body explains
195
+ *why*, not *what* โ€” the diff shows *what*.
196
+ - **One logical change per PR**. If your branch grew into several changes, split it.
197
+ - **PR description**: explain the motivation, summarize the change, and note anything a
198
+ reviewer should double-check. Link related issues.
199
+ - **Target the right branch** (see the table above).
200
+ - **Keep history honest**. Rebase or squash if that produces a cleaner story, but never
201
+ force-push over someone else's work.
202
+
203
+ ## Security
204
+
205
+ If you find a vulnerability, **please do not open a public issue**. Follow the process in
206
+ [`SECURITY.md`](./SECURITY.md) โ€” private disclosure first, so we can fix it before it's
207
+ exploited.
208
+
209
+ ## Questions?
210
+
211
+ If you have questions, ideas, or half-formed insights, you are warmly welcome here.
212
+
213
+ - Open an [issue](https://github.com/mohamed-elkholy95/Pythinker-ai/issues) for bugs or
214
+ feature requests.
215
+ - Start a [discussion](https://github.com/mohamed-elkholy95/Pythinker-ai/discussions) for
216
+ questions, design conversations, and show-and-tell.
217
+
218
+ Thank you for spending your time and care on Pythinker. We would love for more people to
219
+ participate in this community, and we genuinely welcome contributions of all sizes.
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Pythinker contributors
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.
@@ -0,0 +1,321 @@
1
+ Metadata-Version: 2.4
2
+ Name: pythinker-ai
3
+ Version: 0.1.0
4
+ Summary: Pythinker โ€” an ultra-lightweight personal AI agent framework with built-in chat channels, memory, MCP, and an OpenAI-compatible API.
5
+ Project-URL: Homepage, https://github.com/mohamed-elkholy95/Pythinker-ai
6
+ Project-URL: Repository, https://github.com/mohamed-elkholy95/Pythinker-ai
7
+ Project-URL: Documentation, https://github.com/mohamed-elkholy95/Pythinker-ai/tree/main/docs
8
+ Project-URL: Issues, https://github.com/mohamed-elkholy95/Pythinker-ai/issues
9
+ Project-URL: Changelog, https://github.com/mohamed-elkholy95/Pythinker-ai/releases
10
+ Author: Pythinker contributors
11
+ Author-email: Mohamed Elkholy <moelkholy1995@gmail.com>
12
+ Maintainer-email: Mohamed Elkholy <moelkholy1995@gmail.com>
13
+ License: MIT
14
+ License-File: LICENSE
15
+ License-File: THIRD_PARTY_NOTICES.md
16
+ Keywords: agent,ai,anthropic,assistant,chatbot,discord,llm,mcp,openai,slack,telegram,whatsapp
17
+ Classifier: Development Status :: 3 - Alpha
18
+ Classifier: Framework :: AsyncIO
19
+ Classifier: Intended Audience :: Developers
20
+ Classifier: Intended Audience :: End Users/Desktop
21
+ Classifier: License :: OSI Approved :: MIT License
22
+ Classifier: Operating System :: MacOS
23
+ Classifier: Operating System :: Microsoft :: Windows
24
+ Classifier: Operating System :: POSIX :: Linux
25
+ Classifier: Programming Language :: Python
26
+ Classifier: Programming Language :: Python :: 3
27
+ Classifier: Programming Language :: Python :: 3 :: Only
28
+ Classifier: Programming Language :: Python :: 3.11
29
+ Classifier: Programming Language :: Python :: 3.12
30
+ Classifier: Programming Language :: Python :: 3.13
31
+ Classifier: Programming Language :: Python :: 3.14
32
+ Classifier: Topic :: Communications :: Chat
33
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
34
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
35
+ Classifier: Typing :: Typed
36
+ Requires-Python: >=3.11
37
+ Requires-Dist: anthropic<1.0.0,>=0.45.0
38
+ Requires-Dist: chardet<6.0.0,>=3.0.2
39
+ Requires-Dist: croniter<7.0.0,>=6.0.0
40
+ Requires-Dist: ddgs<10.0.0,>=9.5.5
41
+ Requires-Dist: dulwich<1.0.0,>=0.22.0
42
+ Requires-Dist: filelock>=3.25.2
43
+ Requires-Dist: httpx<1.0.0,>=0.28.0
44
+ Requires-Dist: jinja2<4.0.0,>=3.1.0
45
+ Requires-Dist: json-repair<1.0.0,>=0.57.0
46
+ Requires-Dist: loguru<1.0.0,>=0.7.3
47
+ Requires-Dist: mcp<2.0.0,>=1.26.0
48
+ Requires-Dist: oauth-cli-kit<1.0.0,>=0.1.3
49
+ Requires-Dist: openai>=2.8.0
50
+ Requires-Dist: openpyxl<4.0.0,>=3.1.0
51
+ Requires-Dist: prompt-toolkit<4.0.0,>=3.0.50
52
+ Requires-Dist: pydantic-settings<3.0.0,>=2.12.0
53
+ Requires-Dist: pydantic<3.0.0,>=2.12.0
54
+ Requires-Dist: pypdf<6.0.0,>=5.0.0
55
+ Requires-Dist: python-docx<2.0.0,>=1.1.0
56
+ Requires-Dist: python-pptx<2.0.0,>=1.0.0
57
+ Requires-Dist: python-socks[asyncio]<3.0.0,>=2.8.0; sys_platform != 'win32'
58
+ Requires-Dist: python-telegram-bot[socks]<23.0,>=22.6
59
+ Requires-Dist: pyyaml<7.0.0,>=6.0
60
+ Requires-Dist: questionary<3.0.0,>=2.0.0
61
+ Requires-Dist: readability-lxml<1.0.0,>=0.8.4
62
+ Requires-Dist: rich<15.0.0,>=14.0.0
63
+ Requires-Dist: slack-sdk<4.0.0,>=3.39.0
64
+ Requires-Dist: slackify-markdown<1.0.0,>=0.2.0
65
+ Requires-Dist: socksio<2.0.0,>=1.0.0
66
+ Requires-Dist: tiktoken<1.0.0,>=0.12.0
67
+ Requires-Dist: typer<1.0.0,>=0.20.0
68
+ Requires-Dist: websocket-client<2.0.0,>=1.9.0
69
+ Requires-Dist: websockets<17.0,>=16.0
70
+ Provides-Extra: api
71
+ Requires-Dist: aiohttp<4.0.0,>=3.9.0; extra == 'api'
72
+ Provides-Extra: dev
73
+ Requires-Dist: aiohttp<4.0.0,>=3.9.0; extra == 'dev'
74
+ Requires-Dist: pymupdf>=1.25.0; extra == 'dev'
75
+ Requires-Dist: pytest-asyncio<2.0.0,>=1.3.0; extra == 'dev'
76
+ Requires-Dist: pytest-cov<7.0.0,>=6.0.0; extra == 'dev'
77
+ Requires-Dist: pytest<10.0.0,>=9.0.0; extra == 'dev'
78
+ Requires-Dist: ruff>=0.1.0; extra == 'dev'
79
+ Provides-Extra: discord
80
+ Requires-Dist: discord-py<3.0.0,>=2.5.2; extra == 'discord'
81
+ Provides-Extra: langsmith
82
+ Requires-Dist: langsmith>=0.1.0; extra == 'langsmith'
83
+ Provides-Extra: matrix
84
+ Requires-Dist: matrix-nio[e2e]>=0.25.2; (sys_platform != 'win32') and extra == 'matrix'
85
+ Requires-Dist: mistune<4.0.0,>=3.0.0; extra == 'matrix'
86
+ Requires-Dist: nh3<1.0.0,>=0.2.17; extra == 'matrix'
87
+ Provides-Extra: msteams
88
+ Requires-Dist: cryptography>=41.0; extra == 'msteams'
89
+ Requires-Dist: pyjwt<3.0,>=2.0; extra == 'msteams'
90
+ Provides-Extra: pdf
91
+ Requires-Dist: pymupdf>=1.25.0; extra == 'pdf'
92
+ Description-Content-Type: text/markdown
93
+
94
+ ![cover](./images/GitHub_README.png)
95
+
96
+ <div align="center">
97
+ <p>
98
+ <a href="https://pypi.org/project/pythinker-ai/"><img src="https://img.shields.io/pypi/v/pythinker-ai" alt="PyPI"></a>
99
+ <a href="https://pepy.tech/project/pythinker-ai"><img src="https://static.pepy.tech/badge/pythinker-ai" alt="Downloads"></a>
100
+ <img src="https://img.shields.io/badge/python-%E2%89%A53.11-blue" alt="Python">
101
+ <img src="https://img.shields.io/badge/license-MIT-green" alt="License">
102
+ <a href="https://github.com/mohamed-elkholy95/Pythinker-ai/graphs/commit-activity" target="_blank">
103
+ <img alt="Commit activity" src="https://img.shields.io/github/commit-activity/m/mohamed-elkholy95/Pythinker-ai?labelColor=%20%2332b583&color=%20%2312b76a"></a>
104
+ <a href="https://github.com/mohamed-elkholy95/Pythinker-ai/issues?q=is%3Aissue%20is%3Aclosed" target="_blank">
105
+ <img alt="Issues closed" src="https://img.shields.io/github/issues-search?query=repo%3Amohamed-elkholy95%2FPythinker-ai%20is%3Aissue%20is%3Aclosed&label=issues%20closed&labelColor=%20%237d89b0&color=%20%235d6b98"></a>
106
+ <a href="https://github.com/mohamed-elkholy95/Pythinker-ai/stargazers" target="_blank">
107
+ <img alt="Stars" src="https://img.shields.io/github/stars/mohamed-elkholy95/Pythinker-ai?style=flat&logo=github&color=ffd43b"></a>
108
+ </p>
109
+ </div>
110
+
111
+ ๐Ÿ **Pythinker** is an open-source, ultra-lightweight personal-AI-agent framework. It keeps the core agent loop small and readable while still supporting chat channels, long-term memory, MCP, and practical deployment paths โ€” so you can go from local setup to a long-running personal agent with minimal overhead.
112
+
113
+ > Powered by a small, multiplexing agent loop: one Python process listens to Slack, Telegram, Discord, WhatsApp, Matrix, MS Teams, email, a WebSocket WebUI, and an OpenAI-compatible HTTP API โ€” all backed by a single session-scoped memory layer.
114
+
115
+ ## ๐Ÿ’ก Key Features
116
+
117
+ - **Ultra-lightweight** โ€” a small readable core. Stable long-running behavior without orchestration sprawl.
118
+ - **Channel-agnostic** โ€” Slack, Telegram, Discord, WhatsApp, Matrix, MS Teams, email, WebSocket, plus an OpenAI-compatible HTTP API.
119
+ - **Provider-rich** โ€” 25+ LLM providers (Anthropic, OpenAI, Azure OpenAI, OpenAI Codex, GitHub Copilot, Qwen/DashScope, MiniMax, VolcEngine, Moonshot, DeepSeek, StepFun, and more) behind a single interface.
120
+ - **Memory that learns** โ€” a two-phase "Dream" process consolidates long-term memory into `MEMORY.md` / `SOUL.md` / `USER.md`, auto-versioned with pure-Python git.
121
+ - **Skills & MCP** โ€” bundled skills (GitHub, cron, weather, tmux, summarize, skill-creator, โ€ฆ) plus first-class [Model Context Protocol](https://modelcontextprotocol.io/) tool access.
122
+ - **Sandboxed shell** โ€” every command is wrapped in a bubblewrap sandbox on Linux; file tools enforce workspace boundaries.
123
+ - **Hackable** โ€” the Python package is ~55k LOC with zero monolithic orchestration layer. Read it, fork it, extend it.
124
+
125
+ ## ๐Ÿ“ฆ Install
126
+
127
+ > [!IMPORTANT]
128
+ > If you want the newest features and experiments, install from source (the `dev` branch).
129
+ > If you want the most stable day-to-day experience, install from PyPI or with `uv`.
130
+
131
+ **Install from source**
132
+
133
+ ```bash
134
+ git clone https://github.com/mohamed-elkholy95/Pythinker-ai.git
135
+ cd Pythinker-ai
136
+ pip install -e .
137
+ ```
138
+
139
+ **Install with `uv`**
140
+
141
+ ```bash
142
+ uv tool install pythinker-ai
143
+ ```
144
+
145
+ **Install from PyPI**
146
+
147
+ ```bash
148
+ pip install pythinker-ai
149
+ ```
150
+
151
+ ## ๐Ÿš€ Quick Start
152
+
153
+ **1. Initialize**
154
+
155
+ ```bash
156
+ pythinker onboard
157
+ ```
158
+
159
+ The interactive wizard drops a config at `~/.pythinker/config.json` and asks which provider / model you want.
160
+
161
+ **2. Configure** (`~/.pythinker/config.json`)
162
+
163
+ Configure these **two parts** (other options have defaults). Add or merge the blocks below into your existing config rather than replacing the whole file.
164
+
165
+ *Set your API key* (e.g. [OpenRouter](https://openrouter.ai/keys), a good default for global users):
166
+
167
+ ```json
168
+ {
169
+ "providers": {
170
+ "openrouter": {
171
+ "apiKey": "sk-or-v1-xxx"
172
+ }
173
+ }
174
+ }
175
+ ```
176
+
177
+ *Set your model* (optionally pin a provider โ€” defaults to auto-detection):
178
+
179
+ ```json
180
+ {
181
+ "agents": {
182
+ "defaults": {
183
+ "provider": "openrouter",
184
+ "model": "anthropic/claude-opus-4-6"
185
+ }
186
+ }
187
+ }
188
+ ```
189
+
190
+ **3. Chat**
191
+
192
+ ```bash
193
+ pythinker agent
194
+ ```
195
+
196
+ - Want different LLM providers, web search, MCP, security settings, or more config options? See [Configuration](./docs/configuration.md).
197
+ - Want to run Pythinker in chat apps like Telegram, Discord, Slack, WhatsApp, or Matrix? See [Chat Apps](./docs/chat-apps.md).
198
+ - Want Docker or Linux service deployment? See [Deployment](./docs/deployment.md).
199
+
200
+ ## ๐Ÿงช WebUI (Development)
201
+
202
+ > [!NOTE]
203
+ > The WebUI development workflow currently requires a source checkout and is not yet shipped together with the official packaged release. See the [WebUI README](./webui/README.md) for full WebUI development docs and build steps.
204
+
205
+ <p align="center">
206
+ <img src="images/pythinker_webui.png" alt="pythinker webui preview" width="900">
207
+ </p>
208
+
209
+ **1. Enable the WebSocket channel in `~/.pythinker/config.json`**
210
+
211
+ ```json
212
+ { "channels": { "websocket": { "enabled": true } } }
213
+ ```
214
+
215
+ **2. Start the gateway**
216
+
217
+ ```bash
218
+ pythinker gateway
219
+ ```
220
+
221
+ **3. Start the WebUI dev server**
222
+
223
+ ```bash
224
+ cd webui
225
+ bun install
226
+ bun run dev
227
+ ```
228
+
229
+ ## ๐Ÿ—๏ธ Architecture
230
+
231
+ <p align="center">
232
+ <img src="images/pythinker_arch.png" alt="pythinker architecture" width="800">
233
+ </p>
234
+
235
+ ๐Ÿ Pythinker stays lightweight by centering everything around a small agent loop: messages come in from chat apps, the LLM decides when tools are needed, and memory or skills are pulled in only as context instead of becoming a heavy orchestration layer. That keeps the core path readable and easy to extend, while still letting you add channels, tools, memory, and deployment options without turning the system into a monolith.
236
+
237
+ See [`docs/ARCHITECTURE.md`](./docs/ARCHITECTURE.md) for a forensic walkthrough of the runtime.
238
+
239
+ ## โœจ Features
240
+
241
+ <table align="center">
242
+ <tr align="center">
243
+ <th><p align="center">๐Ÿ“ˆ 24/7 Real-Time Market Analysis</p></th>
244
+ <th><p align="center">๐Ÿš€ Full-Stack Software Engineer</p></th>
245
+ <th><p align="center">๐Ÿ“… Smart Daily Routine Manager</p></th>
246
+ <th><p align="center">๐Ÿ“š Personal Knowledge Assistant</p></th>
247
+ </tr>
248
+ <tr>
249
+ <td align="center"><p align="center"><img src="case/search.gif" width="180" height="400"></p></td>
250
+ <td align="center"><p align="center"><img src="case/code.gif" width="180" height="400"></p></td>
251
+ <td align="center"><p align="center"><img src="case/schedule.gif" width="180" height="400"></p></td>
252
+ <td align="center"><p align="center"><img src="case/memory.gif" width="180" height="400"></p></td>
253
+ </tr>
254
+ <tr>
255
+ <td align="center">Discovery โ€ข Insights โ€ข Trends</td>
256
+ <td align="center">Develop โ€ข Deploy โ€ข Scale</td>
257
+ <td align="center">Schedule โ€ข Automate โ€ข Organize</td>
258
+ <td align="center">Learn โ€ข Memory โ€ข Reasoning</td>
259
+ </tr>
260
+ </table>
261
+
262
+ ## ๐Ÿ“š Docs
263
+
264
+ Browse the [repo docs](./docs/README.md) for the current GitHub development version.
265
+
266
+ - Talk to Pythinker from familiar chat apps: [Chat Apps](./docs/chat-apps.md)
267
+ - Configure providers, web search, MCP, and runtime behavior: [Configuration](./docs/configuration.md)
268
+ - Integrate Pythinker with local tools and automations: [OpenAI-Compatible API](./docs/openai-api.md) ยท [Python SDK](./docs/python-sdk.md)
269
+ - Run Pythinker with Docker or as a Linux service: [Deployment](./docs/deployment.md)
270
+ - Deeper dives: [Architecture](./docs/ARCHITECTURE.md) ยท [Memory](./docs/memory.md) ยท [Multiple Instances](./docs/multiple-instances.md) ยท [Channel Plugin Guide](./docs/channel-plugin-guide.md)
271
+
272
+ ## ๐Ÿค Contribute & Roadmap
273
+
274
+ PRs welcome! The codebase is intentionally small and readable. ๐Ÿค—
275
+
276
+ ### Branching Strategy
277
+
278
+ | Branch | Purpose |
279
+ |--------|---------|
280
+ | `main` | Stable releases โ€” bug fixes and minor improvements |
281
+ | `dev` | Experimental features โ€” new features and breaking changes |
282
+
283
+ **Unsure which branch to target?** See [CONTRIBUTING.md](./CONTRIBUTING.md) for details.
284
+
285
+ **Roadmap** โ€” Pick an item and [open a PR](https://github.com/mohamed-elkholy95/Pythinker-ai/pulls)!
286
+
287
+ - **Multi-modal** โ€” See and hear (images, voice, video)
288
+ - **Long-term memory** โ€” Never forget important context
289
+ - **Better reasoning** โ€” Multi-step planning and reflection
290
+ - **More integrations** โ€” Calendar and more
291
+ - **Self-improvement** โ€” Learn from feedback and mistakes
292
+
293
+ ### Contributors
294
+
295
+ <a href="https://github.com/mohamed-elkholy95/Pythinker-ai/graphs/contributors">
296
+ <img src="https://contrib.rocks/image?repo=mohamed-elkholy95/Pythinker-ai&max=100&columns=12" alt="Contributors" />
297
+ </a>
298
+
299
+ ## ๐Ÿ” Security
300
+
301
+ Found a vulnerability? Please **do not open a public issue**. Follow the private disclosure process in [`SECURITY.md`](./SECURITY.md).
302
+
303
+ ## ๐Ÿ“„ License
304
+
305
+ Pythinker is released under the [MIT License](./LICENSE). Third-party components redistributed with the project are listed in [`THIRD_PARTY_NOTICES.md`](./THIRD_PARTY_NOTICES.md).
306
+
307
+ ## โญ Star History
308
+
309
+ <div align="center">
310
+ <a href="https://star-history.com/#mohamed-elkholy95/Pythinker-ai&Date">
311
+ <picture>
312
+ <source media="(prefers-color-scheme: dark)" srcset="https://api.star-history.com/svg?repos=mohamed-elkholy95/Pythinker-ai&type=Date&theme=dark" />
313
+ <source media="(prefers-color-scheme: light)" srcset="https://api.star-history.com/svg?repos=mohamed-elkholy95/Pythinker-ai&type=Date" />
314
+ <img alt="Star History Chart" src="https://api.star-history.com/svg?repos=mohamed-elkholy95/Pythinker-ai&type=Date" style="border-radius: 15px;" />
315
+ </picture>
316
+ </a>
317
+ </div>
318
+
319
+ <p align="center">
320
+ <em>Thanks for visiting โœจ Pythinker!</em>
321
+ </p>