pichu 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.
- pichu-0.1.0/LICENSE +178 -0
- pichu-0.1.0/PKG-INFO +363 -0
- pichu-0.1.0/README.md +323 -0
- pichu-0.1.0/pyproject.toml +99 -0
- pichu-0.1.0/setup.cfg +4 -0
- pichu-0.1.0/src/agent/__init__.py +12 -0
- pichu-0.1.0/src/agent/agent.py +442 -0
- pichu-0.1.0/src/agent/events.py +414 -0
- pichu-0.1.0/src/agent/session.py +546 -0
- pichu-0.1.0/src/client/__init__.py +25 -0
- pichu-0.1.0/src/client/llm_client.py +349 -0
- pichu-0.1.0/src/client/models.py +153 -0
- pichu-0.1.0/src/commands/__init__.py +29 -0
- pichu-0.1.0/src/commands/base.py +168 -0
- pichu-0.1.0/src/commands/builtin/__init__.py +43 -0
- pichu-0.1.0/src/commands/builtin/agents.py +139 -0
- pichu-0.1.0/src/commands/builtin/clear.py +29 -0
- pichu-0.1.0/src/commands/builtin/compact.py +68 -0
- pichu-0.1.0/src/commands/builtin/config_cmd.py +115 -0
- pichu-0.1.0/src/commands/builtin/context.py +113 -0
- pichu-0.1.0/src/commands/builtin/copy_cmd.py +93 -0
- pichu-0.1.0/src/commands/builtin/cost.py +114 -0
- pichu-0.1.0/src/commands/builtin/debug.py +128 -0
- pichu-0.1.0/src/commands/builtin/doctor.py +189 -0
- pichu-0.1.0/src/commands/builtin/exit.py +22 -0
- pichu-0.1.0/src/commands/builtin/export.py +129 -0
- pichu-0.1.0/src/commands/builtin/fork.py +36 -0
- pichu-0.1.0/src/commands/builtin/github.py +409 -0
- pichu-0.1.0/src/commands/builtin/help.py +72 -0
- pichu-0.1.0/src/commands/builtin/hooks.py +27 -0
- pichu-0.1.0/src/commands/builtin/init.py +327 -0
- pichu-0.1.0/src/commands/builtin/login.py +211 -0
- pichu-0.1.0/src/commands/builtin/mcp.py +113 -0
- pichu-0.1.0/src/commands/builtin/memory.py +166 -0
- pichu-0.1.0/src/commands/builtin/model.py +85 -0
- pichu-0.1.0/src/commands/builtin/permissions.py +105 -0
- pichu-0.1.0/src/commands/builtin/rename.py +34 -0
- pichu-0.1.0/src/commands/builtin/rewind.py +153 -0
- pichu-0.1.0/src/commands/builtin/sessions.py +157 -0
- pichu-0.1.0/src/commands/builtin/stats.py +170 -0
- pichu-0.1.0/src/commands/builtin/status.py +118 -0
- pichu-0.1.0/src/commands/builtin/tasks.py +115 -0
- pichu-0.1.0/src/commands/builtin/theme.py +136 -0
- pichu-0.1.0/src/commands/custom_loader.py +203 -0
- pichu-0.1.0/src/commands/router.py +79 -0
- pichu-0.1.0/src/config/__init__.py +80 -0
- pichu-0.1.0/src/config/config.py +1101 -0
- pichu-0.1.0/src/config/loader.py +327 -0
- pichu-0.1.0/src/context/__init__.py +6 -0
- pichu-0.1.0/src/context/compaction.py +118 -0
- pichu-0.1.0/src/context/context_manager.py +314 -0
- pichu-0.1.0/src/hooks/__init__.py +32 -0
- pichu-0.1.0/src/hooks/engine.py +446 -0
- pichu-0.1.0/src/hooks/types.py +270 -0
- pichu-0.1.0/src/main.py +477 -0
- pichu-0.1.0/src/pichu.egg-info/PKG-INFO +363 -0
- pichu-0.1.0/src/pichu.egg-info/SOURCES.txt +135 -0
- pichu-0.1.0/src/pichu.egg-info/dependency_links.txt +1 -0
- pichu-0.1.0/src/pichu.egg-info/entry_points.txt +2 -0
- pichu-0.1.0/src/pichu.egg-info/requires.txt +30 -0
- pichu-0.1.0/src/pichu.egg-info/top_level.txt +13 -0
- pichu-0.1.0/src/prompts/__init__.py +0 -0
- pichu-0.1.0/src/prompts/system.py +422 -0
- pichu-0.1.0/src/safety/__init__.py +39 -0
- pichu-0.1.0/src/safety/approval.py +161 -0
- pichu-0.1.0/src/safety/approval_types.py +21 -0
- pichu-0.1.0/src/safety/command_safety.py +87 -0
- pichu-0.1.0/src/safety/rule_engine.py +81 -0
- pichu-0.1.0/src/safety/sandbox.py +264 -0
- pichu-0.1.0/src/subagents/__init__.py +13 -0
- pichu-0.1.0/src/subagents/loader.py +458 -0
- pichu-0.1.0/src/subagents/transcript.py +350 -0
- pichu-0.1.0/src/subagents/types.py +137 -0
- pichu-0.1.0/src/tools/__init__.py +0 -0
- pichu-0.1.0/src/tools/base.py +212 -0
- pichu-0.1.0/src/tools/builtin/__init__.py +136 -0
- pichu-0.1.0/src/tools/builtin/batch_apply.py +399 -0
- pichu-0.1.0/src/tools/builtin/edit_file.py +242 -0
- pichu-0.1.0/src/tools/builtin/glob.py +463 -0
- pichu-0.1.0/src/tools/builtin/grep.py +648 -0
- pichu-0.1.0/src/tools/builtin/list_dir.py +395 -0
- pichu-0.1.0/src/tools/builtin/memory.py +276 -0
- pichu-0.1.0/src/tools/builtin/read_file.py +162 -0
- pichu-0.1.0/src/tools/builtin/shell.py +397 -0
- pichu-0.1.0/src/tools/builtin/subagent.py +797 -0
- pichu-0.1.0/src/tools/builtin/task_create.py +162 -0
- pichu-0.1.0/src/tools/builtin/task_get.py +151 -0
- pichu-0.1.0/src/tools/builtin/task_list.py +193 -0
- pichu-0.1.0/src/tools/builtin/task_update.py +252 -0
- pichu-0.1.0/src/tools/builtin/web_fetch.py +775 -0
- pichu-0.1.0/src/tools/builtin/web_search.py +525 -0
- pichu-0.1.0/src/tools/builtin/write_file.py +125 -0
- pichu-0.1.0/src/tools/mcp/__init__.py +25 -0
- pichu-0.1.0/src/tools/mcp/client.py +163 -0
- pichu-0.1.0/src/tools/mcp/mcp_manager.py +145 -0
- pichu-0.1.0/src/tools/mcp/mcp_tool.py +68 -0
- pichu-0.1.0/src/tools/registry.py +320 -0
- pichu-0.1.0/src/ui/__init__.py +0 -0
- pichu-0.1.0/src/ui/tui.py +1211 -0
- pichu-0.1.0/src/utils/__init__.py +0 -0
- pichu-0.1.0/src/utils/agents_loader.py +476 -0
- pichu-0.1.0/src/utils/cache.py +646 -0
- pichu-0.1.0/src/utils/checkpoint_manager.py +341 -0
- pichu-0.1.0/src/utils/exceptions.py +51 -0
- pichu-0.1.0/src/utils/loop_detector.py +387 -0
- pichu-0.1.0/src/utils/memory_manager.py +529 -0
- pichu-0.1.0/src/utils/memory_storage.py +489 -0
- pichu-0.1.0/src/utils/memory_types.py +646 -0
- pichu-0.1.0/src/utils/paths.py +29 -0
- pichu-0.1.0/src/utils/runtime_logging.py +329 -0
- pichu-0.1.0/src/utils/session_storage.py +412 -0
- pichu-0.1.0/src/utils/task_manager.py +539 -0
- pichu-0.1.0/src/utils/task_storage.py +339 -0
- pichu-0.1.0/src/utils/task_types.py +387 -0
- pichu-0.1.0/src/utils/text.py +85 -0
- pichu-0.1.0/src/utils/web_security.py +403 -0
- pichu-0.1.0/src/utils/web_types.py +653 -0
- pichu-0.1.0/tests/test_agent_module_exports.py +17 -0
- pichu-0.1.0/tests/test_cli_process_message.py +135 -0
- pichu-0.1.0/tests/test_client_module.py +83 -0
- pichu-0.1.0/tests/test_commands_module.py +223 -0
- pichu-0.1.0/tests/test_config_module.py +119 -0
- pichu-0.1.0/tests/test_context_module.py +110 -0
- pichu-0.1.0/tests/test_github_command.py +99 -0
- pichu-0.1.0/tests/test_hooks.py +1213 -0
- pichu-0.1.0/tests/test_logging_module.py +96 -0
- pichu-0.1.0/tests/test_loop_detection.py +502 -0
- pichu-0.1.0/tests/test_mcp_manager.py +78 -0
- pichu-0.1.0/tests/test_memory_system.py +385 -0
- pichu-0.1.0/tests/test_prompts_system.py +42 -0
- pichu-0.1.0/tests/test_safety_module.py +101 -0
- pichu-0.1.0/tests/test_session_reference_resolution.py +81 -0
- pichu-0.1.0/tests/test_sessions.py +179 -0
- pichu-0.1.0/tests/test_subagent_module.py +109 -0
- pichu-0.1.0/tests/test_task_manager.py +79 -0
- pichu-0.1.0/tests/test_tool_registry.py +57 -0
- pichu-0.1.0/tests/test_ui_tui.py +49 -0
pichu-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
Copyright 2025 pichu Contributors
|
pichu-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,363 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: pichu
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: ⚡ pichu — code, compile, conquer
|
|
5
|
+
Author: pichu Contributors
|
|
6
|
+
License-Expression: Apache-2.0
|
|
7
|
+
Requires-Python: >=3.13
|
|
8
|
+
Description-Content-Type: text/markdown
|
|
9
|
+
License-File: LICENSE
|
|
10
|
+
Requires-Dist: beautifulsoup4>=4.12.3
|
|
11
|
+
Requires-Dist: click>=8.1.7
|
|
12
|
+
Requires-Dist: ddgs>=8.1.1
|
|
13
|
+
Requires-Dist: fastmcp>=2.12.0
|
|
14
|
+
Requires-Dist: html2text>=2024.2.26
|
|
15
|
+
Requires-Dist: httpx>=0.27.0
|
|
16
|
+
Requires-Dist: lxml>=5.0
|
|
17
|
+
Requires-Dist: openai>=1.52.0
|
|
18
|
+
Requires-Dist: pathspec>=0.11.0
|
|
19
|
+
Requires-Dist: platformdirs>=4.3.0
|
|
20
|
+
Requires-Dist: playwright>=1.50.0
|
|
21
|
+
Requires-Dist: pydantic>=2.9.0
|
|
22
|
+
Requires-Dist: pypdf>=5.3.0
|
|
23
|
+
Requires-Dist: python-dotenv>=1.0.1
|
|
24
|
+
Requires-Dist: pyyaml>=6.0.2
|
|
25
|
+
Requires-Dist: rich>=13.9.0
|
|
26
|
+
Requires-Dist: tenacity>=9.0.0
|
|
27
|
+
Requires-Dist: tiktoken>=0.9.0
|
|
28
|
+
Requires-Dist: tomlkit>=0.13.2
|
|
29
|
+
Provides-Extra: dev
|
|
30
|
+
Requires-Dist: build>=1.2.2.post1; extra == "dev"
|
|
31
|
+
Requires-Dist: mypy>=1.11.0; extra == "dev"
|
|
32
|
+
Requires-Dist: pre-commit>=3.7.0; extra == "dev"
|
|
33
|
+
Requires-Dist: pytest>=8.0.0; extra == "dev"
|
|
34
|
+
Requires-Dist: pytest-asyncio>=0.23.0; extra == "dev"
|
|
35
|
+
Requires-Dist: pytest-cov>=5.0.0; extra == "dev"
|
|
36
|
+
Requires-Dist: ruff>=0.5.0; extra == "dev"
|
|
37
|
+
Requires-Dist: twine>=5.1.1; extra == "dev"
|
|
38
|
+
Requires-Dist: types-pyyaml>=6.0.0; extra == "dev"
|
|
39
|
+
Dynamic: license-file
|
|
40
|
+
|
|
41
|
+
<p align="center">
|
|
42
|
+
<img src="assets/logo.png" alt="pichu Logo" width="200" /><br/>
|
|
43
|
+
<strong>⚡ pichu — code, compile, conquer.</strong><br/>
|
|
44
|
+
Coding agent that lives in your terminal.
|
|
45
|
+
</p>
|
|
46
|
+
|
|
47
|
+
---
|
|
48
|
+
|
|
49
|
+
<p align="center">
|
|
50
|
+
<img src="assets/demo.gif" alt="pichu Demo" />
|
|
51
|
+
</p>
|
|
52
|
+
|
|
53
|
+
## Features
|
|
54
|
+
|
|
55
|
+
- **Composable tooling stack** — file editing/search, shell, web research, task tools, and memory tools
|
|
56
|
+
- **Context management** — token-aware context windows with compaction, tool-output pruning, and usage tracking
|
|
57
|
+
- **MCP integration** — connect and manage external MCP servers, with namespaced MCP tools available alongside built-ins
|
|
58
|
+
- **Sub-agent orchestration** — delegate work to specialized sub-agents with isolated context, scoped tool access, and resume/background support
|
|
59
|
+
- **28 slash commands** — operational control for config, diagnostics, sessions, permissions, hooks, tasks, MCP, GitHub setup, and more
|
|
60
|
+
- **Web tooling with guardrails** — structured search/fetch, citation-style outputs, cache modes, rate limits, provenance checks, and PDF extraction
|
|
61
|
+
- **Session system** — JSONL transcript persistence, metadata indexing, resume/continue, checkpoints, rewind, and forked sessions
|
|
62
|
+
- **Memory system** — global + project memory stores, AGENTS hierarchy loading, and searchable categorized memories
|
|
63
|
+
- **Task orchestration** — persistent task lists with status transitions, dependency graphs, ownership, and cross-session coordination
|
|
64
|
+
- **Hooks automation** — lifecycle hooks (`PreToolUse`, `PostToolUse`, `Stop`, `PreCompact`, `SubagentStop`, etc.) with matcher-based routing
|
|
65
|
+
- **Safety by default** — approval policies, rule-based permission engine, dangerous-command detection, and filesystem sandbox enforcement
|
|
66
|
+
- **Reliability controls** — LLM retry/backoff, loop detection, context compaction, tool-output pruning, and runtime/audit logging
|
|
67
|
+
|
|
68
|
+
## Quick Start
|
|
69
|
+
|
|
70
|
+
### 1) Prerequisites
|
|
71
|
+
|
|
72
|
+
- Python 3.13+
|
|
73
|
+
- [uv](https://docs.astral.sh/uv/) (recommended)
|
|
74
|
+
- An LLM API key (for example, [OpenRouter](https://openrouter.ai/))
|
|
75
|
+
|
|
76
|
+
### 2) Install
|
|
77
|
+
|
|
78
|
+
```bash
|
|
79
|
+
# uv tool install (recommended for end users)
|
|
80
|
+
uv tool install pichu
|
|
81
|
+
|
|
82
|
+
# pip
|
|
83
|
+
pip install pichu
|
|
84
|
+
|
|
85
|
+
# Linux/macOS one-line installer
|
|
86
|
+
curl -fsSL https://raw.githubusercontent.com/yeabwang/pichu/main/install.sh | bash
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
### 3) Configure model credentials
|
|
90
|
+
|
|
91
|
+
Interactive (recommended):
|
|
92
|
+
|
|
93
|
+
```bash
|
|
94
|
+
pichu
|
|
95
|
+
/login
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
Environment variable:
|
|
99
|
+
|
|
100
|
+
```bash
|
|
101
|
+
# Linux / macOS
|
|
102
|
+
export LLM_API_KEY="your-key-here"
|
|
103
|
+
|
|
104
|
+
# Windows PowerShell
|
|
105
|
+
$env:LLM_API_KEY = "your-key-here"
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
Base URL and model are configured via `/login` (stored in `~/.pichu/config.toml`).
|
|
109
|
+
|
|
110
|
+
### 4) Initialize project files
|
|
111
|
+
|
|
112
|
+
Inside a `pichu` session in your project directory, run:
|
|
113
|
+
|
|
114
|
+
```bash
|
|
115
|
+
/init
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
This generates `AGENTS.md`, `AGENTS.local.md`, and `.pichu/config.toml` for the current project.
|
|
119
|
+
|
|
120
|
+
### 5) Run and validate
|
|
121
|
+
|
|
122
|
+
```bash
|
|
123
|
+
# Interactive mode
|
|
124
|
+
pichu
|
|
125
|
+
|
|
126
|
+
# Single prompt
|
|
127
|
+
pichu "explain this repo"
|
|
128
|
+
|
|
129
|
+
# Run tests
|
|
130
|
+
uv run pytest -q
|
|
131
|
+
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
### CLI Options
|
|
135
|
+
|
|
136
|
+
```
|
|
137
|
+
pichu [PROMPT] Run interactively, or execute a single prompt
|
|
138
|
+
-c, --cwd PATH Set working directory for the agent
|
|
139
|
+
-C, --continue Resume the most recent session in this directory
|
|
140
|
+
-r, --resume ID_OR_TITLE Resume a specific session by ID or title
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
## Commands
|
|
144
|
+
|
|
145
|
+
pichu includes 28 slash commands for runtime control. Type `/help` inside a session for the full list.
|
|
146
|
+
|
|
147
|
+
| Command | Description |
|
|
148
|
+
| ---------------- | ------------------------------------------------ |
|
|
149
|
+
| `/agents` | List loaded sub-agents |
|
|
150
|
+
| `/clear` | Clear conversation history |
|
|
151
|
+
| `/compact` | Compact context with optional focus instructions |
|
|
152
|
+
| `/config` | View or open settings configuration |
|
|
153
|
+
| `/context` | Visualize context token usage |
|
|
154
|
+
| `/copy` | Copy last response to clipboard |
|
|
155
|
+
| `/cost` | Token usage and cost statistics |
|
|
156
|
+
| `/debug` | Troubleshoot current session |
|
|
157
|
+
| `/doctor` | Health check installation |
|
|
158
|
+
| `/exit` | Exit the session |
|
|
159
|
+
| `/export` | Export conversation to file |
|
|
160
|
+
| `/fork` | Fork this session into a new branch |
|
|
161
|
+
| `/github` | Setup/status for GitHub MCP tasks |
|
|
162
|
+
| `/help` | Display help information and available commands |
|
|
163
|
+
| `/hooks` | Display registered lifecycle hooks |
|
|
164
|
+
| `/init` | Initialize project with AGENTS.md |
|
|
165
|
+
| `/login` | Configure API key, provider, and model |
|
|
166
|
+
| `/mcp` | Manage MCP server connections |
|
|
167
|
+
| `/memory` | Edit memory files (AGENTS.md) |
|
|
168
|
+
| `/model` | Switch or view the AI model |
|
|
169
|
+
| `/permissions` | Show approval policy and permission rules |
|
|
170
|
+
| `/rename` | Rename the current session |
|
|
171
|
+
| `/rewind` | Rewind to a previous checkpoint |
|
|
172
|
+
| `/sessions` | List and manage saved sessions |
|
|
173
|
+
| `/stats` | Usage visualizations (tokens, turns, duration) |
|
|
174
|
+
| `/status` | Version, model, and connectivity info |
|
|
175
|
+
| `/tasks` | List and manage tasks |
|
|
176
|
+
| `/theme` | Change color theme |
|
|
177
|
+
|
|
178
|
+
## Built-in Tools
|
|
179
|
+
|
|
180
|
+
The agent has access to 16 built-in tools:
|
|
181
|
+
|
|
182
|
+
| Tool | Description |
|
|
183
|
+
| --------------- | ----------------------------------------- |
|
|
184
|
+
| `read_file` | Read file contents |
|
|
185
|
+
| `write_file` | Create or overwrite files |
|
|
186
|
+
| `edit_file` | Apply targeted edits to existing files |
|
|
187
|
+
| `batch_apply` | Apply multiple file operations atomically |
|
|
188
|
+
| `shell` | Execute shell commands |
|
|
189
|
+
| `list_dir` | List directory contents |
|
|
190
|
+
| `grep` | Search file contents with regex |
|
|
191
|
+
| `glob` | Find files by name pattern |
|
|
192
|
+
| `web_search` | Search the web |
|
|
193
|
+
| `web_fetch` | Fetch and extract web page content |
|
|
194
|
+
| `task_create` | Create a task in the task list |
|
|
195
|
+
| `task_update` | Update task status or metadata |
|
|
196
|
+
| `task_get` | Get details of a specific task |
|
|
197
|
+
| `task_list` | List all tasks |
|
|
198
|
+
| `memory` | Save, search, or manage project memory |
|
|
199
|
+
| `subagent_*` | Delegate work to a specialized sub-agent |
|
|
200
|
+
|
|
201
|
+
## Configuration
|
|
202
|
+
|
|
203
|
+
Configuration is loaded in this order (later sources override earlier ones):
|
|
204
|
+
|
|
205
|
+
1. **Code defaults** — sensible baseline values
|
|
206
|
+
2. **System config** — `~/.pichu/config.toml`
|
|
207
|
+
3. **Project config** — `.pichu/config.toml` (searched upward from cwd)
|
|
208
|
+
4. **System .env** — `~/.pichu/.env` (used for persisted keys from `/login`)
|
|
209
|
+
5. **Project .env** — `.env` in the current working directory
|
|
210
|
+
6. **Environment overrides** — `LLM_API_KEY` and `PICHU_DEBUG`
|
|
211
|
+
|
|
212
|
+
Behavior instructions for the agent are loaded from `AGENT.md` in the nearest discovered `.pichu` directory.
|
|
213
|
+
|
|
214
|
+
## Troubleshooting
|
|
215
|
+
|
|
216
|
+
When something goes wrong, use this recovery flow:
|
|
217
|
+
|
|
218
|
+
1. Run `/doctor` for a full installation + config health check.
|
|
219
|
+
2. Run `/status` to verify model/provider/session state.
|
|
220
|
+
3. Run `/debug` for runtime diagnostics in the current session.
|
|
221
|
+
4. Check logs in `logs/app/` and `logs/security/audit.log` for concrete errors.
|
|
222
|
+
|
|
223
|
+
Common cases:
|
|
224
|
+
|
|
225
|
+
- **API failures (401/403/5xx):** re-run `/login`, then confirm `LLM_API_KEY` and `llm.base_url` / `llm.model` in `~/.pichu/config.toml`.
|
|
226
|
+
- **MCP connection issues:** run `/mcp` to inspect configured servers and connection state.
|
|
227
|
+
- **Sandbox violations:** review `[safety.sandbox]` in `.pichu/config.toml` and allowed path settings.
|
|
228
|
+
|
|
229
|
+
### Environment Variables
|
|
230
|
+
|
|
231
|
+
| Variable | Required | Description |
|
|
232
|
+
| --------------------- | -------- | -------------------------------------------------- |
|
|
233
|
+
| `LLM_API_KEY` | Yes | API key for your LLM provider |
|
|
234
|
+
| `SERPER_API_KEY` | No | API key for web search (Serper) |
|
|
235
|
+
| `PICHU_DEBUG` | No | Enable debug logging (`true`/`false`) |
|
|
236
|
+
| `PICHU_PROJECT_DIR` | No | Project config directory name (default:`.pichu`) |
|
|
237
|
+
| `PICHU_CONFIG_FILE` | No | Config file name (default:`config.toml`) |
|
|
238
|
+
|
|
239
|
+
## Development
|
|
240
|
+
|
|
241
|
+
### Install
|
|
242
|
+
|
|
243
|
+
Option A (recommended): use uv project sync + Makefile workflow
|
|
244
|
+
|
|
245
|
+
```bash
|
|
246
|
+
git clone https://github.com/yeabwang/pichu.git
|
|
247
|
+
cd pichu
|
|
248
|
+
|
|
249
|
+
uv venv
|
|
250
|
+
|
|
251
|
+
uv sync --extra dev
|
|
252
|
+
uv run pre-commit install
|
|
253
|
+
```
|
|
254
|
+
|
|
255
|
+
Option B: requirements-based install
|
|
256
|
+
|
|
257
|
+
```bash
|
|
258
|
+
git clone https://github.com/yeabwang/pichu.git
|
|
259
|
+
cd pichu
|
|
260
|
+
|
|
261
|
+
uv venv
|
|
262
|
+
uv pip install -r requirements-dev.txt && uv pip install -e .
|
|
263
|
+
```
|
|
264
|
+
|
|
265
|
+
### Requirements Files
|
|
266
|
+
|
|
267
|
+
| File | Contents |
|
|
268
|
+
| ------------------------ | ----------------------------------------- |
|
|
269
|
+
| `requirements.txt` | Runtime dependencies (core + web tooling) |
|
|
270
|
+
| `requirements-dev.txt` | Core + testing, linting, and build tools |
|
|
271
|
+
|
|
272
|
+
Use the Makefile for common development workflows:
|
|
273
|
+
|
|
274
|
+
```bash
|
|
275
|
+
# Install dev dependencies + pre-commit hooks
|
|
276
|
+
make dev
|
|
277
|
+
|
|
278
|
+
# Common commands
|
|
279
|
+
make format # auto-format with ruff
|
|
280
|
+
make lint # lint with ruff
|
|
281
|
+
make typecheck # type-check with mypy
|
|
282
|
+
make test # run tests
|
|
283
|
+
make test-cov # tests + coverage report
|
|
284
|
+
make build # build package
|
|
285
|
+
make clean # remove caches & artifacts
|
|
286
|
+
```
|
|
287
|
+
|
|
288
|
+
### Run Tests
|
|
289
|
+
|
|
290
|
+
```bash
|
|
291
|
+
uv run pytest -q
|
|
292
|
+
```
|
|
293
|
+
|
|
294
|
+
### Project Bootstrap
|
|
295
|
+
|
|
296
|
+
Inside a pichu session, run `/init` to generate a full `.pichu/config.toml` baseline and project guidance files. If these files are missing, startup now prompts you to run `/init`.
|
|
297
|
+
|
|
298
|
+
### Build
|
|
299
|
+
|
|
300
|
+
```bash
|
|
301
|
+
make build # produces sdist + wheel in dist/
|
|
302
|
+
# or: uv build
|
|
303
|
+
```
|
|
304
|
+
|
|
305
|
+
## Deployment
|
|
306
|
+
|
|
307
|
+
### Docker
|
|
308
|
+
|
|
309
|
+
```bash
|
|
310
|
+
docker build -t pichu:latest .
|
|
311
|
+
docker run --rm -it -e LLM_API_KEY=your-key -v "$(pwd)":/workspace pichu:latest
|
|
312
|
+
```
|
|
313
|
+
|
|
314
|
+
### CI
|
|
315
|
+
|
|
316
|
+
GitHub Actions runs tests and builds on every push/PR — see `.github/workflows/ci.yml`.
|
|
317
|
+
|
|
318
|
+
See [docs/deployment.md](docs/deployment.md) for full deployment details.
|
|
319
|
+
|
|
320
|
+
## Architecture
|
|
321
|
+
|
|
322
|
+
```
|
|
323
|
+
pichu/
|
|
324
|
+
├── main.py CLI entrypoint — wires config → agent → TUI
|
|
325
|
+
├── src/
|
|
326
|
+
│ ├── agent/ Runtime orchestration loop, events, session lifecycle
|
|
327
|
+
│ ├── client/ LLM transport and stream parsing
|
|
328
|
+
│ ├── commands/ Slash command registry and 28 built-in handlers
|
|
329
|
+
│ ├── config/ Configuration schema, loader, and merge logic
|
|
330
|
+
│ ├── context/ Context window management and compaction
|
|
331
|
+
│ ├── hooks/ Lifecycle hook framework
|
|
332
|
+
│ ├── prompts/ System prompt construction
|
|
333
|
+
│ ├── safety/ Approval policies, sandbox, and command risk checks
|
|
334
|
+
│ ├── subagents/ Sub-agent loader/types/transcripts + bundled specs
|
|
335
|
+
│ ├── tools/ Built-in and MCP tool implementations
|
|
336
|
+
│ ├── ui/ Terminal rendering (Rich-based TUI)
|
|
337
|
+
│ └── utils/ Sessions, memory, tasks, web helpers, and more
|
|
338
|
+
├── tests/ Test suite (pytest)
|
|
339
|
+
└── docs/ Module-level developer documentation
|
|
340
|
+
```
|
|
341
|
+
|
|
342
|
+
## Documentation
|
|
343
|
+
|
|
344
|
+
Detailed developer guides for each module:
|
|
345
|
+
|
|
346
|
+
- [Agent Module](docs/agent-module.md) — runtime loop, events, session lifecycle
|
|
347
|
+
- [Client Module](docs/client-module.md) — LLM client, streaming, retry
|
|
348
|
+
- [Commands Module](docs/commands-module.md) — slash command system
|
|
349
|
+
- [Config Module](docs/config-module.md) — configuration schema and loading
|
|
350
|
+
- [Context Module](docs/context-module.md) — context management and compaction
|
|
351
|
+
- [Hooks Module](docs/hooks-module.md) — lifecycle hook engine
|
|
352
|
+
- [Logging Module](docs/logging-module.md) — runtime and audit logging
|
|
353
|
+
- [MCP Module](docs/mcp-module.md) — MCP server integration
|
|
354
|
+
- [Safety Module](docs/safety-module.md) — approval and sandbox policies
|
|
355
|
+
- [Sub-agents Module](docs/subagents-module.md) — sub-agent orchestration
|
|
356
|
+
- [Task Management](docs/task-management.md) — task system architecture
|
|
357
|
+
- [Tool Management](docs/tool-management.md) — tool registry and execution
|
|
358
|
+
- [Utils Module](docs/utils-module.md) — shared runtime utilities
|
|
359
|
+
- [Deployment](docs/deployment.md) — Docker, CI, and packaging
|
|
360
|
+
|
|
361
|
+
## License
|
|
362
|
+
|
|
363
|
+
Apache 2.0 — see [LICENSE](LICENSE).
|