BrightRule 明规
集团制度管理与智能问询 — Policy Management & AI Policy Assistant, built on
ObjectStack.
条款级、可追溯效力、问完就能办的集团制度平台:
- 条款级管理 — 制度拆到「条」入库,回答精确引用条款号,效力与版本落到条款粒度。
- 效力可追溯 — 起草→审批→发布→修订→废止全生命周期,可查任一历史日期的有效版本。
- 带权限的 AI 问询 — 智能体直接按提问人的行级权限读取制度,看不到的制度不会出现在回答里。
- 问完就能办 — 「怎么办」类问题直接引导到对应业务流程。
产品定位、架构判断与分期见 docs/product-brief.md(草案,待评审)。
当前仓库是脚手架初始化状态:note 是脚手架自带的示例对象,领域模型在设计评审通过后替换它。
Development
Scaffolded with create-objectstack (blank template, ObjectStack 18.6.0).
Getting started
pnpm install
pnpm dev
After editing any metadata (an object, view, flow, …), run pnpm validate —
see Verify your changes below. It is the one command
this project's AGENTS.md calls unskippable: it catches mistakes that
otherwise fail silently at runtime.
The REST API is served at http://localhost:3000/api/v1. Data endpoints
require a session — the dev server seeds a login-ready admin
(admin@objectos.ai / admin123) on an empty database:
curl -c cookies.txt -X POST http://localhost:3000/api/v1/auth/sign-in/email \
-H "Content-Type: application/json" \
-d '{"email":"admin@objectos.ai","password":"admin123"}'
curl -b cookies.txt "http://localhost:3000/api/v1/data/<your_object>"
The sample note object
src/objects/note.object.ts is a sample, there so a blank project has one
object to boot, query and test on day one. It is not part of the app you are
building: until you remove it, it ships in every build, is served over REST,
is listed to any MCP client next to your own objects, and is the one entry of
the starter app. Delete or replace it once your own objects exist:
- Delete
src/objects/note.object.ts and its export line in
src/objects/index.ts.
- Delete
src/views/note.view.ts and its export line in
src/views/index.ts, and the Notes entry in src/apps/main.app.ts (put
your own objects there instead — see The Console below).
- Point
note.test.ts at one of your own objects (rename the file to match).
It imports Note, as do the view and the app, so they stop compiling until
you do.
- Run
pnpm validate and pnpm test.
The Console
pnpm dev also serves the admin Console at http://localhost:3000/_console/,
and prints the link on boot. Open it and you will see this project's app,
Main, beside the platform's own apps (Setup, Account); its Notes entry
opens the list of sample notes.
An object appears in Console navigation only when an app lists it.
src/apps/main.app.ts lists the sample object, and src/views/note.view.ts
draws its list. A package whose manifest type is app holds at most one app,
so main.app.ts is the one: to show another object, add a navigation entry for
it to that app's navigation (a group entry with children nests them) rather
than a second app, and give it a list view. objectstack generate view OBJECT
writes the view and its export line together; the Console renders both after
the next pnpm dev rebuild. The
objectstack-ui skill covers the shape; describing the app you want to your
coding agent is the intended path.
Your app is an MCP server
Every ObjectStack app is itself a
Model Context Protocol server — on by
default, no plugin to install. pnpm dev prints the endpoint and a
ready-to-paste connect command on boot; point a coding agent (Claude Code,
Cursor, any MCP client) at it and it can read your schema, query data, and run
your exposed actions — all under the caller's own permissions and RLS:
claude mcp add --transport http my-app http://localhost:3000/api/v1/mcp
Set OS_MCP_SERVER_ENABLED=false to turn it off. This is the serve side — the
reverse of the mcp connector below (which lets your app call other MCP
servers). See Connect an MCP Client
for OAuth, API keys, and which objects/actions become tools.
Layout
objectstack.config.ts — environment manifest (objects, API, plugins), and
the wiring for every directory below
src/objects/ — object definitions (one file per object); note.object.ts
is the sample described above
src/apps/ — the starter app, main.app.ts, described in
The Console; src/views/ — the sample object's list view
src/actions/, src/flows/, src/dashboards/, src/skills/,
src/picklists/, src/security/ (permission sets), src/datasets/
(analytics datasets) — empty to start. Each directory's index.ts
exports what it holds and objectstack.config.ts hands those exports to the
stack, so objectstack generate flow NAME (or view, action, …) adds a
file and one export line, and the item is loaded, and counted by
pnpm validate, with no edit to the config
note.test.ts — the starter test pnpm test runs, configured by
vitest.config.ts
Connectors (default providers)
objectstack.config.ts wires the three generic connector executors, so you
can call an external system from a flow as pure metadata — no host code:
| Provider |
Package |
Use for |
rest |
@objectstack/connector-rest |
Any JSON/HTTP REST API |
openapi |
@objectstack/connector-openapi |
An API described by an OpenAPI document |
mcp |
@objectstack/connector-mcp |
A Model Context Protocol server |
Add a connectors: entry that names one of these providers and the
automation capability materializes it into a live, dispatchable connector at
boot — see Automation → Connectors
for how that materialization works; a flow's connector_action node then
calls it. To add a brand connector (e.g. Slack), install its package and add
new ConnectorSlackPlugin() to plugins:; to drop a provider, remove its
plugin.
Security — declarative MCP over stdio. An mcp connector whose transport
spawns a local process (stdio) is denied by default, because the command
comes from metadata. Opt in per host with
new ConnectorMcpPlugin({ declarativeStdio: ['node'] }); http transports
need no opt-in.
See Automation → Flows for
the full connector and connector_action guide.
Verify your changes
After editing any metadata, run:
pnpm validate # schema + CEL predicates + widget bindings (no artifact)
pnpm lint # authoring rules validate does not run — e.g. a handler that
# stopped lowering to a metadata-only body
pnpm typecheck # TypeScript types against @objectstack/spec
pnpm test # your app's own tests, against the real engine
pnpm validate runs the same gates as pnpm build and catches mistakes that
otherwise fail silently at runtime — e.g. a bare done (instead of
record.done) in an action predicate that would hide the action on every
record. See AGENTS.md for the full convention.
pnpm test checks what the app does. note.test.ts boots this app's stack
in-process with bootStack from @objectstack/verify (in-memory database, no
server) and asserts one business fact through its handle: a note without a
title is refused. Write your own the same way: stack.hooks.run makes a real
write through validation, permissions and hooks, and the same handle runs flows
and actions, seeds fixtures and reads rows as a given user.
Deploy
The project ships container-ready — the Dockerfile builds your metadata into
an artifact and runs it on the official ObjectStack runtime image
(ghcr.io/objectstack-ai/objectstack):
# Image only
docker build -t my-app .
# Or the full app + Postgres stack
cat > .env <<EOF
POSTGRES_PASSWORD=$(openssl rand -hex 16)
OS_AUTH_SECRET=$(openssl rand -hex 32)
OS_SECRET_KEY=$(openssl rand -hex 32)
EOF
docker compose up -d
curl -fsS http://localhost:8080/api/v1/health
Bare Node, Kubernetes, reverse-proxy wiring, and the required secrets are
covered in Self-Hosted Deployment.
A Studio change is not in the image
The image carries what src/ builds into, and nothing else. A change you save
in Studio, in the Console pnpm dev serves, is stored in that environment's
database (locally, .objectstack/data/) as an item of the package
<this app's package id>.custom. It is never written to src/, so
pnpm build, the Dockerfile and docker compose leave it behind.
- To make it part of the app, make the same change in
src/: that is what is
validated, reviewed and deployed. Ask your coding agent to do it in code, not
in Studio.
- To keep it as a customization, take it out as a package while
pnpm dev
runs: npx os login --url http://localhost:3000 once, then
npx os package export --url http://localhost:3000, writes every package the database holds that
src/ does not register, the .custom package among them, to
objectstack-export/NN-ID/objectstack.json. Commit that directory, and once
the deployment is up install each file into it in the numbered order with
npx os package install objectstack-export/NN-ID/objectstack.json --url URL.
pnpm build prints a notice when your local dev database holds such a change.
Next steps
- Add an object: see the
objectstack-data skill.
- Add a view or app: see
objectstack-ui.
- Add a flow or automation: see
objectstack-automation.
- Add an AI agent: see
objectstack-ai.
Skills live in .claude/skills/ and are committed with this project, once.
They come from the @objectstack/skills dev dependency, at the version of
@objectstack/spec, are installed one agent runtime at a time (see
AGENTS.md), and also show up in the in-IDE assistant catalog. Re-install them
from node_modules after upgrading the @objectstack/* packages:
npx skills@1.7.2 experimental_sync --agent claude-code --copy -y