octo-server
CLAUDE.md1.1k starsChanged 5 months agoApache-2.0View on GitHub
Octo-server is the Go backend for DMWork (enterprise IM platform). It handles business logic on top of WuKongIM for messaging transport. 27 modules in modules/, each auto-registered via init() + register.AddModule(). Standard module structure: - 1module.go — registration entry (init() + register.AddModule()) - api*.go — HTTP handlers implementing register.APIRouter.Route(r *wkhttp.WKHttp) - service.go — business logic, typically defines IService interface - db*.go — database operations using gocraft/dbr - model.go — data models and response structs - sql/ — SQL migrations embedded…
Trending
Quiet since September.about the whole repository
Who's talking about Mininglamp-OSS/octo-server
- YMJ-ML/octo-server-backlog“[octo-server #920] OIDC login permanently fails with uk_uid_issuer 1062 when upstream rotates a user's sub”GitHub · Sep 29, 2026
- YMJ-ML/octo-server-backlog“[octo-server #890] Bot API rate-limit collateral: invalid-credential requests still drain the shared per-IP …”GitHub · Sep 27, 2026
- YMJ-ML/octo-server-backlog“[octo-server #891] Bot DM replies are mis-routed to the bot's earliest-joined Space when the bot is a …”GitHub · Sep 27, 2026
- Mininglamp-OSS/octo-im“fix: reconcile subscribers with durable business revisions”GitHub · Sep 24, 2026
- YMJ-ML/octo-server-backlog“[octo-server #914] ✨ 名片展示手机号与邮箱 · 可见范围与字段下发”GitHub · Sep 24, 2026
The biggest 5 of 38 mentions linking to the repository that our crawl found. Each line is their own headline.
See all 38
Talked about on GitHub (38 times).
On GitHub · 38
- Sep 29, 2026[octo-server #920] OIDC login permanently fails with uk_uid_issuer 1062 when upstream rotates a user's sub — YMJ-ML/octo-server-backlog0 reactions · 6 comments
- Sep 27, 2026[octo-server #890] Bot API rate-limit collateral: invalid-credential requests still drain the shared per-IP bucket and 503 healthy bots — YMJ-ML/octo-server-backlog0 reactions · 5 comments
- Sep 27, 2026[octo-server #891] Bot DM replies are mis-routed to the bot's earliest-joined Space when the bot is a member of multiple Spaces — YMJ-ML/octo-server-backlog0 reactions · 6 comments
- Sep 24, 2026fix: reconcile subscribers with durable business revisions — Mininglamp-OSS/octo-im0 reactions · 1 comment
- Sep 24, 2026[octo-server #914] ✨ 名片展示手机号与邮箱 · 可见范围与字段下发 — YMJ-ML/octo-server-backlog0 reactions · 6 comments
33 more on GitHub
- Sep 24, 2026[octo-server #913] Project: use native membership for linked groups — YMJ-ML/octo-server-backlog0 reactions · 5 comments
- Sep 24, 2026[octo-server #911] fix(obo): move resolve endpoint to internal auth — YMJ-ML/octo-server-backlog0 reactions · 6 comments
- Sep 23, 2026[octo-server #909] fix(obo): preserve independent grant lifecycles — YMJ-ML/octo-server-backlog0 reactions · 6 comments
- Sep 23, 2026[octo-server #907] fix(obo): configure action scope mappings — YMJ-ML/octo-server-backlog0 reactions · 5 comments
- Sep 23, 2026feat(chat): show cross-Space unread badges — Mininglamp-OSS/octo-web0 reactions · 3 comments
- Sep 23, 2026[octo-server #903] feat(message): include per-Space unread totals in conversation sync — YMJ-ML/octo-server-backlog0 reactions · 6 comments
- Sep 23, 2026feat(chat): show unread counts for non-current spaces — Mininglamp-OSS/octo-web0 reactions
- Sep 22, 2026[octo-server #901] fix(group): isolate E2E tests from shared runtime state — YMJ-ML/octo-server-backlog0 reactions · 6 comments
- Sep 22, 2026[octo-server #900] feat(obo): add owner-only bot delegation resolver — YMJ-ML/octo-server-backlog0 reactions · 5 comments
- Sep 17, 2026[octo-server #896] Add thread archive endpoint for bots (Bot API) — YMJ-ML/octo-server-backlog0 reactions · 6 comments
- Sep 17, 2026[octo-server #777] bug(bot_api): 撤回消息经 /v1/bot/messages/sync 泄漏原文,应返回占位态 [WS-168] — YMJ-ML/octo-server-backlog0 reactions · 7 comments
- Sep 17, 2026[octo-server #831] octo-server 启动 panic:thread 模块迁移重复添加 thread.message_count 列,导致 CrashLoopBackOff — YMJ-ML/octo-server-backlog0 reactions · 6 comments
- Sep 16, 2026[octo-server #894] Prevent AI agents from deleting user-owned documents (ownership guard, audit, recycle bin) — YMJ-ML/octo-server-backlog0 reactions · 5 comments
- Sep 16, 2026[octo-server #825] AI 功能支持按用户/角色授权控制(Per-user / role-based access control for AI features) — YMJ-ML/octo-server-backlog0 reactions · 8 comments
- Sep 16, 2026[octo-server #826] 邀请注册与公开注册支持独立开关(Separate toggle for invite-based registration, or email domain whitelist) — YMJ-ML/octo-server-backlog0 reactions · 6 comments
- Sep 1, 2026feat(market): Space review UI for plugins across skills/connectors/experts — l-s-c/octo-web0 reactions · 1 comment
- Aug 10, 2026feat(octo-web): support custom group avatar editing — Mininglamp-OSS/octo-web0 reactions · 2 comments
- Aug 10, 2026Smith: octo-server (triage-trial) — lucas-albers-lz4/regexproof0 reactions
- Aug 6, 2026feat: 聊天文件卡片一键转存云盘 + 已存状态区分 — Mininglamp-OSS/octo-web0 reactions · 4 comments
- Jul 23, 2026fix(i18n): align onboarding and product terminology — Mininglamp-OSS/octo-web0 reactions · 2 comments
- Jul 14, 2026【common】初始化应用配置失败","error":"encrypt private key: OCTO_MASTER_KEY not configured: refusing to store unencrypted private key" — Mininglamp-OSS/octo-lib0 reactions · 2 comments
- Jul 13, 2026feat: internal card dispatch boundary — sole trusted in-process type-17 origination (dormant foundation) — dmwork-org/octo-server0 reactions
- Jul 10, 2026feat(doc_event_receiver): OCT-137/A receive doc webhook events and forward to IM — Ranwanglc/octo-server0 reactions
- Jul 10, 2026feat(docs_proxy): OCT-144 · /v1/docs/proxy/*path reverse proxy w/ X-Octo-Token — Ranwanglc/octo-server0 reactions
- Jul 2, 2026feat: add Octo (Mininglamp-OSS) product page — CiferaTeam/awesome-agents-team0 reactions
- Jun 22, 2026feat(auth): replace hand-rolled middleware with octo-auth/sdk-go — Mininglamp-OSS/octo-matter0 reactions · 14 comments
- May 27, 2026feat(wkhttp): add ErrorRenderer/TokenParser hooks + move ratelimit/secure_cors (#46) — Mininglamp-OSS/octo-lib0 reactions
- May 26, 2026feat(flow): shell and github_status node types — yujiawei/octo-server0 reactions · 1 comment
- May 26, 2026feat(flow): wire cron trigger into flow lifecycle, validate, expose next_trigger_at — yujiawei/octo-server0 reactions · 2 comments
- May 26, 2026[Octo Voice] Local ASR per-user config CRUD — Mininglamp-OSS/octo-speech0 reactions · 1 comment
- May 26, 2026[Octo Voice] Local ASR 开关前端实现 — Mininglamp-OSS/octo-web0 reactions · 1 comment
- May 26, 2026feat(flow): Phase 1.1 — data model + DAG engine + basic nodes + triggers + REST API — yujiawei/octo-server0 reactions · 2 comments
- May 19, 2026feat(issue-feed): simplify to new/reopen only, remove project-group and IssueTriage — Mininglamp-OSS/.github0 reactions · 1 comment
In this repository2 other files it gives its agents.
- AGENTS.mdAGENTS.md
- octospec-workflowSkill
The file
We split this CLAUDE.md into the rules it gives an agent
4 rules. About 0 are common, 0 are distinctive, and 4 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈0
Distinctive · estimate
This author's own choices. Worth a look.
4
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 66
All user-facing error responses go through the i18n error envelope.
- Very specific: line 111
Use the shared middleware in octo-lib pkg/wkhttp/ratelimit.go — do NOT hand-roll Redis INCR/TTL counters for request-frequency limiting.
- Very specific: line 146
Commit messages: English, Conventional Commits (feat:, fix:, test:, refactor:)
- Very specific: line 166
Before changing load-bearing behavior: read the rules whose inject_when matches the files you are touching (see …
≈ “Common” is an estimate: at least 1 in 5 of the 12,729 CLAUDE.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
CLAUDE.md
This file provides guidance to Claude Code when working with code in this repository.
Project Overview
Octo-server is the Go backend for DMWork (enterprise IM platform). It handles business logic on top of WuKongIM for messaging transport.
- Go Module:
github.com/Mininglamp-OSS/octo-server - Go Version: 1.25
- Shared Library:
github.com/Mininglamp-OSS/octo-lib(config, wkhttp, testutil, register, model) - Default Branch:
main
Common Commands
# Build
docker build -t octo-server .
# Run tests (single module)
go test ./modules/group/...
go test ./modules/message/ -run TestSendMsg
# Run all tests
go test ./...
# Lint
golangci-lint run ./...Architecture
Request Flow
HTTP (Gin/wkhttp) → Auth Middleware (pkg/auth/) → Space Middleware → API Handler → Service → DB (MySQL/DBR)
↓
WuKongIM (gRPC)Module System
27 modules in modules/, each auto-registered via init() + register.AddModule().
Standard module structure:
1module.go— registration entry (init()+register.AddModule())api*.go— HTTP handlers implementingregister.APIRouter.Route(r *wkhttp.WKHttp)service.go— business logic, typically definesIServiceinterfacedb*.go— database operations usinggocraft/dbrmodel.go— data models and response structssql/— SQL migrations embedded via//go:embed sql
Key Packages
| Package | Purpose |
pkg/auth/ | Token parsing, CacheTokenParser, auth middleware |
pkg/errcode/ | Error code definitions per module (group.go, message.go, user.go, oidc.go) |
pkg/httperr/ | ResponseErrorL / ResponseErrorLWithStatus error facades |
pkg/i18n/ | Localization SDK: codes registry, localizer, renderer, language negotiation, locales/ |
internal/ | Internal wiring, module imports |
modules/base/event/ | Async event system |
Error Handling & i18n (Localization)
All user-facing error responses go through the i18n error envelope. Never use
c.ResponseError(errors.New(...)), c.ResponseErrorf(...), c.AbortWithStatusJSON(...),
or non-OK c.JSON(...) — these are legacy and bypass the localized envelope.
Two facades (pkg/httperr) — the envelope body is identical, only the wire status differs:
| Facade | Wire status | Use for |
ResponseErrorL(c, code, params, details) | pinned 400 (D14 compat); real status in error.http_status | default — every legacy-bearing endpoint |
ResponseErrorLWithStatus(c, code, params, details) | the code's real HTTPStatus | new endpoints only with no clients depending on fixed-400 (currently just modules/oidc bind); diverging from D14 needs maintainer sign-off |
httperr.ResponseErrorL(c, errcode.ErrGroupQueryFailed, nil, nil)Error codes — register in pkg/errcode/<module>.go:
ErrXxx = register(codes.Code{
ID: "err.server.<module>.<reason>", // or reuse err.shared.* (auth/rate/param/internal/not_found)
HTTPStatus: http.StatusBadRequest,
DefaultMessage: "English source (D4).", // zh-CN runtime translation goes in active.zh-CN.toml
SafeDetailKeys: []string{"field"}, // whitelist for details; all other keys are dropped
Internal: false, // see invariant below
})- 5xx ⟺
Internal=true(renderer hides the message + details; log the cause viazap.Errorbefore responding). 4xx codes must NOT be Internal. - Anti-enumeration: auth / verify failures map to ONE generic code (e.g. a single 401), never a per-reason code — the specific reason goes to logs only.
- Params vs Details (D15):
paramsinterpolate into the message template;detailsare structured fields surfaced to the client, filtered bySafeDetailKeys.
Per-module helpers live in modules/<module>/api_i18n.go (respond<Module>Xxx for detail-carrying shapes; mustLookupSharedCode resolves shared codes at init, panicking loudly if unregistered).
After adding/changing any code, these must pass (also enforced in CI):
make i18n-extract # regenerate en-US markers from codes.Register call sites
make i18n-extract-check # 100% recall: every registered code has a marker
make i18n-lint # D23 guard (no new raw error responses) + unregistered-code checkThen add the zh-CN translation to pkg/i18n/locales/active.zh-CN.toml (one ["id"] + other = "..." block per code).
Guard test: each migrated module has a Test<Module>NoLegacyResponseError source guard forbidding legacy/raw responses — add any new handler files to its list. Protocol endpoints that intentionally keep raw responses (e.g. OAuth2/OIDC browser-redirect flow) are exempted and tracked in tools/lint-direct-error-response/baseline.txt.
Emails: localized templates live in modules/base/common/emailtmpl/templates/{lang}/ (per-language subject/html/text, go:embed). Send functions take a lang arg resolved via i18n.OutboundLanguage(ctx) — never hardcode subject/body strings.
Rate Limiting
Use the shared middleware in octo-lib pkg/wkhttp/ratelimit.go — do NOT hand-roll Redis INCR/TTL counters for request-frequency limiting. Three layers, each sets X-RateLimit-Limit/Remaining/Scope/Retry-After headers, returns i18n rate.limited, and is fail-open on Redis errors:
| Middleware | Scope header | Dimension | Use for |
RateLimitMiddleware | ip | global per-IP | DDoS floor — already mounted globally in main.go (route.Use), don't re-add |
StrictIPRateLimitMiddleware(tag, rps, burst) | strict:{tag} | per-IP, per-endpoint | unauthenticated sensitive endpoints (login/register/sms/search/group_invite/space_invite) |
SharedUIDRateLimiter(r, ctx) (wraps UIDRateLimitMiddleware) | uid | per-login-user, shared bucket ratelimit:uid:{uid} | default for authenticated endpoints |
SharedUIDRateLimiter (pkg/wkhttp/ratelimit_helper.go) is a process-wide singleton — one quota per UID across all mounted routes (default 2 rps / burst 60, tunable via DM_API_UID_RATELIMIT_RPS/_BURST). Mount it AFTER AuthMiddleware on the route group, else it can't read the uid and silently fails open:
auth := r.Group("/v1/foo", ctx.AuthMiddleware(r), appwkhttp.SharedUIDRateLimiter(r, ctx))Exception — per-resource cooldowns keyed by a business identity (phone/email/bind-session), which the IP/UID buckets cannot express, may use a hand-written Redis counter: e.g. sms_rate_limit:{zone}@{phone} (base/common/service_sms.go), email_rate_limit:{email} (base/common/service_email.go), OIDC bind attempt caps. These are intentional; generic HTTP request-frequency limiting is not.
Tests that hit UID-limited routes must reset the bucket in setup (ratelimit:uid:*) — see category test's resetUIDRateLimit; the bucket persists in Redis and is NOT cleared by CleanAllTables.
Database
- ORM:
gocraft/dbrv2 - Migration files:
modules/<name>/sql/<yyyyMMdd>-<seq>_<name>.sql, embedded via//go:embed sql - Field naming: underscore (
util.AttrToUnderscore())
Testing
_, ctx := testutil.NewTestServer()
defer testutil.CleanAllTables(ctx)Tests require MySQL + Redis + WuKongIM running (see CI or make env-test in dmworkim).
Coding Conventions
- Commit messages: English, Conventional Commits (
feat:,fix:,test:,refactor:) - API routes: prefix
/v1/ - New modules: add blank import in
internal/modules.go - Auth: all routes go through
AuthMiddlewareunless explicitly excluded — document why if skipping - i18n: user-facing errors use
httperr.ResponseErrorL+ a registeredpkg/errcodecode; never rawc.ResponseError/c.JSON/AbortWithStatusJSON. Runmake i18n-extract-check+make i18n-lintafter touching codes (see Architecture › Error Handling & i18n) - Rate limiting: mount
SharedUIDRateLimiter(auth routes) orStrictIPRateLimitMiddleware(unauth) — never hand-roll a Redis counter for request-frequency limiting (see Architecture › Rate Limiting) - Space isolation: handlers that access user data must go through Space middleware
- Bot API (
modules/bot_api/): validate bot ownership before operations - Thread (
modules/thread/): verify parent channel access
<!-- octospec:begin -->octo-spec workflow
This repo participates in the octo-spec
engineering standard. Shared rules live in .octospec/.
- Rules:
.octospec/rules/— the source of truth for this repo's conventions (error-handling, rate-limit, space-isolation, testing, commit-style). The global "constitution" rules are pulled into git-ignored.octospec/_global/viaoctospec-sync(pin in.octospec/manifest.yaml). - Before changing load-bearing behavior: read the rules whose
inject_whenmatches the files you are touching (see.octospec/rules/_index.yaml). - Tasks: capture goal / load-bearing list / out-of-scope / acceptance in
.octospec/tasks/<slug>/brief.md(template:tasks/_brief.template.md). - PRs: fill Linked Spec + the COMPREHENSION three questions for load-bearing, architectural, or P0 changes. Trivial changes (typo/docs/lint/config) are exempt.
This region is managed by octospec-sync; edit outside the markers.
<!-- octospec:end -->Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

