octo-server
AGENTS.md1.1k starsChanged 5 months agoApache-2.0View on GitHub
Octo-server is the Go backend for DMWork, an 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 for config, wkhttp, testutil, register, and model packages - Default branch: main Modules live in modules/. Each module is auto-registered with init() and register.AddModule(). Standard module layout: All user-facing error responses go through the i18n error envelope. Do not use c.ResponseError(errors.New(...)), c.ResponseErrorf(...), c.AbortWithStatusJSON(...), or non-OK c.JSON(...);…
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
Where files are headingNew AGENTS.md files have more rules about keeping secrets out of the code, and fewer about checking a change actually works.
Of the AGENTS.md files we read, the 11,773 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.
In this repository2 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- octospec-workflowSkill
The file
Show its rules and text
We split this AGENTS.md into the rules it gives an agent
14 rules. About 0 are common, 5 are distinctive, and 9 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈5
Distinctive · estimate
This author's own choices. Worth a look.
9
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 71
All user-facing error responses go through the i18n error envelope.
- Very specific: line 76
Use the facades in pkg/httperr:
- Distinctive: line 112
After adding or changing error codes, run:
- Very specific: line 136
Use the shared middleware in octo-lib pkg/wkhttp/ratelimit.go.
- Distinctive: line 180
Use the shared test utilities:
- Very specific: line 190
When changing behavior, run the narrowest relevant go test package first.
- Very specific: line 196
Use English Conventional Commits when committing, such as feat:, fix:, test:, and refactor:.
- Very specific: line 199
Add a blank import in internal/modules.go for new modules.
- Very specific: line 200
All routes go through AuthMiddleware unless explicitly excluded.
- Very specific: line 205
Run make i18n-extract-check and make i18n-lint after touching error codes or localized error behavior.
- Distinctive: line 209
Do not hand-roll Redis counters for generic HTTP request-frequency limiting.
- Distinctive: line 214
Follow existing module, service, DB, and handler patterns before introducing new abstractions.
- Distinctive: line 216
Keep changes scoped to the requested behavior and avoid unrelated refactors.
- Very specific: line 217
Run gofmt on edited Go files.
≈ “Common” is an estimate: at least 1 in 5 of the 16,595 AGENTS.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
AGENTS.md
This file provides guidance to coding agents when working in this repository.
Project Overview
Octo-server is the Go backend for DMWork, an 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-libfor config, wkhttp, testutil, register, and model packages - Default branch:
main
Common Commands
# Build
docker build -t octo-server .
# Run tests for a 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)
|
v
WuKongIM (gRPC)Module System
Modules live in modules/. Each module is auto-registered with init() and
register.AddModule().
Standard module layout:
1module.go: registration entry usinginit()andregister.AddModule()api*.go: HTTP handlers implementingregister.APIRouter.Route(r *wkhttp.WKHttp)service.go: business logic, usually with anIServiceinterfacedb*.go: database operations usinggocraft/dbrmodel.go: data models and response structssql/: SQL migrations embedded with//go:embed sql
Key Packages
| Package | Purpose |
pkg/auth/ | Token parsing, CacheTokenParser, auth middleware |
pkg/errcode/ | Error code definitions per module, such as group, message, user, and OIDC |
pkg/httperr/ | ResponseErrorL and ResponseErrorLWithStatus error facades |
pkg/i18n/ | Localization SDK: code registry, localizer, renderer, language negotiation, and locales/ |
internal/ | Internal wiring and module imports |
modules/base/event/ | Async event system |
Error Handling and i18n
All user-facing error responses go through the i18n error envelope. Do not use
c.ResponseError(errors.New(...)), c.ResponseErrorf(...),
c.AbortWithStatusJSON(...), or non-OK c.JSON(...); these are legacy patterns
and bypass the localized envelope.
Use the facades in pkg/httperr:
| Facade | Wire status | Use for |
ResponseErrorL(c, code, params, details) | Pinned 400 for D14 compatibility; real status in error.http_status | Default for legacy-bearing endpoints |
ResponseErrorLWithStatus(c, code, params, details) | The code's real HTTPStatus | New endpoints only when no clients depend on fixed 400; maintainer sign-off is required when diverging from D14 |
httperr.ResponseErrorL(c, errcode.ErrGroupQueryFailed, nil, nil)Register error codes in pkg/errcode/<module>.go:
ErrXxx = register(codes.Code{
ID: "err.server.<module>.<reason>", // or reuse err.shared.* codes
HTTPStatus: http.StatusBadRequest,
DefaultMessage: "English source (D4).",
SafeDetailKeys: []string{"field"},
Internal: false,
})Error-code rules:
- 5xx codes must set
Internal=true; 4xx codes must not. The renderer hides messages and details for internal errors, so log the cause withzap.Errorbefore responding. - Auth and verification failures use one generic anti-enumeration code, such as a single 401. Specific failure reasons go to logs only.
paramsinterpolate into the message template.detailsare structured client-facing fields filtered bySafeDetailKeys.- Per-module helpers live in
modules/<module>/api_i18n.go. mustLookupSharedCoderesolves shared codes at init and should panic loudly when a shared code is not registered.
After adding or changing error codes, run:
make i18n-extract
make i18n-extract-check
make i18n-lintThen add the zh-CN translation to pkg/i18n/locales/active.zh-CN.toml with one
["id"] block and other = "..." value per code.
Each migrated module has a Test<Module>NoLegacyResponseError source guard
that forbids legacy and raw error responses. Add new handler files to that
guard's file list. Protocol endpoints that intentionally keep raw responses,
such as OAuth2/OIDC browser-redirect flows, are exempted through
tools/lint-direct-error-response/baseline.txt.
Localized email templates live in
modules/base/common/emailtmpl/templates/{lang}/. Send functions take a lang
argument resolved through i18n.OutboundLanguage(ctx); do not hardcode
localized subject or body strings.
Rate Limiting
Use the shared middleware in octo-lib pkg/wkhttp/ratelimit.go. Do not
hand-roll Redis INCR and TTL counters for generic request-frequency limiting.
The rate limit layers set X-RateLimit-Limit, X-RateLimit-Remaining,
X-RateLimit-Scope, and X-RateLimit-Retry-After headers, return the i18n
rate.limited response, and fail open on Redis errors.
| Middleware | Scope header | Dimension | Use for |
RateLimitMiddleware | ip | Global per-IP | DDoS floor; already mounted globally in main.go via route.Use, so do not re-add it |
StrictIPRateLimitMiddleware(tag, rps, burst) | strict:{tag} | Per-IP, per-endpoint | Unauthenticated sensitive endpoints such as login, register, SMS, search, group invite, and space invite |
SharedUIDRateLimiter(r, ctx) | uid | Per-login-user shared bucket ratelimit:uid:{uid} | Default for authenticated endpoints |
SharedUIDRateLimiter wraps UIDRateLimitMiddleware and is defined in
pkg/wkhttp/ratelimit_helper.go. It is a process-wide singleton with one quota
per UID across all mounted routes. Defaults are 2 rps and burst 60, tunable via
DM_API_UID_RATELIMIT_RPS and DM_API_UID_RATELIMIT_BURST.
Mount SharedUIDRateLimiter after AuthMiddleware; otherwise it cannot read
the UID and silently fails open.
auth := r.Group("/v1/foo", ctx.AuthMiddleware(r), appwkhttp.SharedUIDRateLimiter(r, ctx))Per-resource cooldowns keyed by business identity, such as phone, email, or bind
session, may use a hand-written Redis counter when IP and UID buckets cannot
express the rule. Existing examples include sms_rate_limit:{zone}@{phone},
email_rate_limit:{email}, and 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, such as
ratelimit:uid:*. The bucket persists in Redis and is not cleared by
CleanAllTables.
Database
- ORM:
gocraft/dbrv2 - Migration files:
modules/<name>/sql/<yyyyMMdd>-<seq>_<name>.sql - SQL migrations are embedded via
//go:embed sql - Field naming uses underscore conversion through
util.AttrToUnderscore()
Testing
Use the shared test utilities:
_, ctx := testutil.NewTestServer()
defer testutil.CleanAllTables(ctx)Tests require MySQL, Redis, and WuKongIM to be running. Check CI or
make env-test in dmworkim for the expected test environment.
When changing behavior, run the narrowest relevant go test package first. Run
broader tests when the change touches shared behavior, cross-module contracts,
middleware, auth, rate limiting, or database migrations.
Coding Conventions
- Use English Conventional Commits when committing, such as
feat:,fix:,test:, andrefactor:. - API routes use the
/v1/prefix. - Add a blank import in
internal/modules.gofor new modules. - All routes go through
AuthMiddlewareunless explicitly excluded; document the reason when skipping auth. - User-facing errors use
httperr.ResponseErrorLwith a registeredpkg/errcodecode. Do not use rawc.ResponseError,c.JSON, orAbortWithStatusJSONfor non-OK responses. - Run
make i18n-extract-checkandmake i18n-lintafter touching error codes or localized error behavior. - Authenticated routes should mount
SharedUIDRateLimiter. - Unauthenticated sensitive endpoints should mount
StrictIPRateLimitMiddleware. - Do not hand-roll Redis counters for generic HTTP request-frequency limiting.
- Handlers that access user data must go through the Space middleware.
- Bot API code in
modules/bot_api/must validate bot ownership before operations. - Thread code in
modules/thread/must verify parent channel access. - Follow existing module, service, DB, and handler patterns before introducing new abstractions.
- Keep changes scoped to the requested behavior and avoid unrelated refactors.
- Run
gofmton edited Go files.
<!-- octospec:begin -->octo-spec engineering standard
This repo carries shared engineering rules in .octospec/, readable by any
coding agent working in this checkout (Claude Code, Codex, OpenClaw, or others).
- Rules:
.octospec/rules/(+ index.octospec/rules/_index.yaml) — the source of truth for this repo's conventions: error-handling, rate-limit, space-isolation, testing, commit-style. - Before changing load-bearing behavior, read the rules whose
inject_whenmatches the files you touch. - Tasks: capture goal / load-bearing list / out-of-scope / acceptance in
.octospec/tasks/<slug>/brief.md. - PRs: fill Linked Spec + the COMPREHENSION three questions for load-bearing, architectural, or P0 changes; trivial changes (typo/docs/lint/config) are exempt.
Claude Code users also have /octospec-plan|go|check|finish slash commands
(committed under .claude/commands/). Other agents read the same .octospec/
files directly.
This region is managed by octospec; 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.

