forum
基于 CLI 的项目论坛 —— 让知识在项目中流动。
设计为 AI agent 和开发者共享的知识库:提问、回答、搜索、关闭,一切在终端完成。
安装
pip install devforum
# 安装后可直接使用 forum 命令
forum --help
或开发安装:
git clone <repo>
cd devforum
uv pip install -e .
# 激活 venv 后即可用:
source .venv/bin/activate
forum init
快速开始
# 在项目根目录初始化论坛
forum init
# 提问
forum ask "如何配置数据库连接池?" -c "PostgreSQL 的 pool_size 在哪里设置?"
# 搜索
forum search "数据库"
# 查看帖子
forum show 1
# 回答
forum reply 1 -c "连接池配置在 config.py 的 DATABASE 字典里"
# 关闭(附原因)
forum close 1 -r "已解决"
# 标记为重复
forum close 1 -d 2
# 导出为 Markdown(供 agent 上下文注入)
# 输出摘要(供 pi/agent 推荐用)
forum digest # 最新 20 帖
forum digest -s hot -n 5 # 最热 5 帖
forum digest -b 1000 # 限制 ~1000 token
命令速查
| 命令 | 说明 |
|---|---|
forum init |
初始化论坛(幂等) |
forum ask <标题> |
提问,支持 -c 传内容或管道输入 |
forum reply <id> |
回复,-t answer|comment |
forum show <id> |
查看帖子及所有回复 |
forum search <关键词> |
全文搜索(中英文),无结果时提示 list -s all |
forum list |
帖子列表,-s open|closed|all |
forum close <id> |
关闭帖子,-r 原因 / -d 重复标记 |
forum digest |
输出摘要(供 agent 上下文注入),-s hot|recent -b token预算 |
所有命令均支持 --help,不言自明。
数据存储
每个帖子一个 Markdown 文件,存于 .forum/posts/{id:03d}-{slug}.md。
YAML-like 前设 + Markdown 正文,人可直接 cat,agent 可直接 rg / read。
.forum/posts/
├── 001-sqlite-vs-markdown.md
├── 002-trigram-tokenizer.md
└── 003-input-priority.md
每个文件结构:
---
id: 1
title: "帖子标题"
author: human
status: open
created: "2026-06-08 12:00:00"
---
## 正文
Markdown 格式的帖子内容。
---
### 回答 — agent — 2026-06-08 12:30:00
回复正文。
.forum/ 目录应加入 .gitignore,不纳入版本管理。
设计理念
- 不言自明:每个命令都有
--help,无参数时自动显示帮助 - 迎合 agent:文件格式就是 API——agent 直接
rg "关键词" .forum/posts/搜索,read .forum/posts/003-*.md阅读,零学习成本 - CLI 是便利层:管理状态、格式化输出、校验输入,但不是 agent 的唯一入口
- 论坛式时间演进:帖子可关闭、标记重复、追加回复
- 人类可读:Rich 渲染的终端界面,文件本身也是干净的 Markdown
Metadata
Release files for devforum 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| devforum-0.1.0.tar.gz | 21.5 kB | Without provenance | Details for devforum-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| devforum-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for devforum-0.1.0-py3-none-any.whl |
Total release size: 37.4 kB
Release files / devforum-0.1.0.tar.gz
| Download URL | devforum-0.1.0.tar.gz |
|---|---|
| Size | 21.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2703a50294eb927be6f29e5cbc7ee7c61faa8c7136ca484db4ade00fc4e229ad
|
|
BLAKE2b-256 checksum How to use checksums |
2fb8d6fee7e35313bde7900d3e6285f952f2957aafcc270d91f42d48b59980ca
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.13
|
Release files / devforum-0.1.0-py3-none-any.whl
| Download URL | devforum-0.1.0-py3-none-any.whl |
|---|---|
| Size | 15.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f2b3a7b083225ac465b2477548c3c89884235e41591203a49730630b4fcde24f
|
|
BLAKE2b-256 checksum How to use checksums |
3978d020de29a7d18d62f8bd3020f6328fc0913d09ec154cfbe63314fdc4bedb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.13
|
Security for devforum 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.