All docs

Standards library

- 产品规格.md §3.2.1 (three layers of knowledge documents), §3.2.2 (standards library), §4.2.4 (platform plugins)

Source docs/en/site/mech-standards.md

Status: Phase 1 shipped; multi-dimension index trees + full-screen three-pane admin UI (2026-07-25) shipped API and /workspace/standards; source crawl / impact lists still pending.

Truth: User-visible capabilities in docs/产品规格.md §3.2.2; this page is for design and implementation mapping.

Voice: UI and help use user language (“standards library”, “published”, “pending review”, “browse by region”, and so on); table names, APIs, and paths appear only in §7.

Related:


1. Goal

  • Inside a workspace, provide a shared source of truth for laws, industry standards, management policies, and management theory (user language: standards library).
  • Let platform plugins such as HR and compliance generate questionnaires, check items, grades, and competency data from the same source.
  • Let work assistants (or scheduled tasks) fetch updates from registered official sites, then after human review and publish, affect plugins and conversation.
  • Let agents answer from published standards and, where possible, land on document number / version / source.

1.1 Non-goals (first phase)

  • Do not replace each plugin’s own business store (rosters, inspection instances, remediation tickets still live in the plugin).
  • Do not make the standards library an alias of ordinary “workspace knowledge” folders (see §2).
  • Do not allow “the site was crawled, so checklists / grade data / public wording change automatically”.
  • Do not require plugins to crawl each other’s Markdown on disk.

2. Split from “workspace knowledge documents”

| | Workspace knowledge documents | Standards library | |--|-------------------|------------| | Who it mainly serves | Conversation Q&A, team wiki | Plugin-generated rules and data, compliance citations, article Q&A | | Typical content | Process notes, FAQ, project background | Government / industry law, management policy, competency theory as source of truth | | Change gate | Maintainers can edit directly | Draft → review → published; laws default to human review | | Version and effect | Weak | Strong (document number, in-force / repealed, source URL, content hash) | | For plugins | Usually does not drive writes | A published version may drive questionnaires / check items (must confirm again) |

Optional: when a standard is published, sync a conversation summary into workspace knowledge; source of truth and version still come from the standards library.


3. Product decisions (confirmed, 2026-07-25)

#TopicDecision
1User-visible nameStandards library (subtitle may be “laws and management standards”)
2IsolationPer workspace; no cross-workspace reads
3Where it livesPlatform workspace capability, not under a plugin’s private folder
4Crawl vs in forceCrawl = proposal (draft); in force only after publish
5What agents may readDefault published only; drafts visible only to admins / policy roles
6Plugins reading standardsPlatform read-only API (launch token or workspace-member auth), subscribe by domain tag
7Plugin-to-plugin businessCadau signs a short-lived call + audit; do not pass full legal text through plugin-to-plugin calls
8Automatic official-site updatesSource allowlist only; legal types default to human review; effective date configurable
9Impact on pluginsChange broadcast + impact list, preview then confirm before writing the business store; no silent overwrite
10Factory defaultsPlugins may ship default templates (e.g. HR catalog); published workspace standards may override / trim
11Browse structureMulti-dimension index trees (region, industry, and so on); the tree is a filter view, not a physical knowledge folder; one standard may hang on many trees and nodes
12Admin UIPrefer “switch index → left tree → middle list → right body”; collaboration page as entry, full management on a dedicated full-screen page
13Versus check schemes (2026-08-07)Expert practice machine packs do not enter the standards library pretending to be articles; they go in check schemes (must cite this library); see 检查方案.md, 合规实践检查表转机读包.md. Repealed the 2026-08-06 conclusion that “machine packs live in the standards library”

4. User-visible capabilities (planned)

4.1 Standard entries

Each standard should let the user understand at least:

  • Title, body (or attachment)
  • Type: law / industry standard / internal policy / management theory, and so on
  • Domain tags (UI suggests defaults such as HR / labor / compliance / competency; users may add their own; plugins filter by machine values such as hr, labor, compliance, competency)
  • Document number / issuing body (legal types)
  • Effective date, repeal date (may be empty)
  • Source: manual upload / official-site crawl (including URL)
  • Status: draft, pending review, published, repealed
  • Version (increments under the same document number, or by publish batch)

4.2 Source allowlist

  • Workspace admins register official domains and entry pages that may be crawled (plus optional parse notes / skills).
  • Addresses not on the allowlist: must not auto-crawl into the standards library.

4.3 Crawl and pending review

  • A work assistant or scheduled task checks updates on the allowlist → compares document number / content hash / effective info marked on the site.
  • On change, create a draft or pending-review entry and a change summary (a human-readable diff vs the last published version).
  • Laws and mandatory industry standards: default must be human-reviewed before publish.
  • Internal policies: policy may allow “low-risk auto-publish” (human review still recommended by default).

4.4 Publish and enable

  • Review passes → published; may set an enable date (aligned with the legal effective date).
  • Support rollback to the previous published version (unconfirmed plugin recalculations may be cancelled).

4.5 Impact list for plugins

After a standard is published, the platform notifies subscribed plugins by domain tag (e.g. HR, compliance):

  • List capabilities that may be affected (questionnaire templates, check items, grade packs, and so on).
  • Plugins provide “preview against the new standard” → confirm → write the business store.
  • Each generation must record: standard ID + version (audit and trace).

4.6 Agent Q&A

  • Retrieval scope: published, enable date reached, not repealed.
  • Answers should cite the basis (title, document number, version, or source link) where possible.
  • Looking up “current workspace business facts” (roster, a given inspection conclusion) still goes through each plugin’s operations (e.g. plugin_invoke); do not impersonate live business data with the standards library.

4.7 Multi-dimension index trees (browse and manage)

Standards often need to be arranged by region, industry, effect type, business domain, and so on; users expect a tree on the left and a way to switch “how we index”. That is easy to confuse with §3.2.1 knowledge-base trees; the contract is below.

#### 4.7.1 Product principles

#PrincipleNote
1The entry is the source of truthPrimary key remains the standard entry (ID + version + publish status); the tree does not replace the source
2The tree is an indexEach tree = node hierarchy under one classification dimension, for browse and filter
3Multi-attachThe same standard may appear on many trees and many nodes (e.g. “national / labor” and “generic industry / employment”)
4Not a knowledge pathDo not store the standard body primarily under a knowledge-document physical path, or use a “folder path” as the standard ID
5Gates stayDraft / pending review / published / repealed and human-review rules are not weakened by tree browse
6Coexist with flat tagsExisting domain tags may still drive plugin subscribe and simple filters; index nodes may map to tags or coexist; migration may use tags only

#### 4.7.2 User language

  • Index mode: switch in the top or side, e.g. “by region”, “by industry”, “by type”.
  • Classification tree: nodes under the current index mode (add / edit / delete / sort; admins maintain).
  • Uncategorized: entries not attached to any node in the current dimension sit in their own column, so existence is not “only if it is in a folder”.

#### 4.7.3 UI skeleton (next stage)

┌─────────────────────────────────────────────────────────────┐
│ Standards library     [By region ▾]     Back to workspace collaboration │
├──────────┬────────────────────┬────────────────────────────┤
│ Classification tree │ Entries under the current node │ Title / metadata / body │
│ (expandable)│ (status, document number, version) │ Save draft · submit · publish… │
└──────────┴────────────────────┴────────────────────────────┘
  • Look and feel may align with the knowledge-document admin “three panes”, but the left is the classification tree of the current index, not a knowledge/ directory.
  • The collaboration page may keep a short intro + “Manage standards library”; full editing goes to a dedicated full-screen route (same idea as “Manage workspace knowledge base”).

#### 4.7.4 Sketch

Standard entry: Labor Contract Law of the PRC v3 (published)
  ├─ On the “region” tree: National → Labor and employment
  ├─ On the “industry” tree: Generic → Human resources
  └─ On the “type” tree: Law

Plugin subscribe may still filter published entries by domain tag or index node ID; when generating business data, record standard ID + version (and optional node path for audit display).

#### 4.7.5 Implementation mapping (shipped)

ConceptImplementation
DimensionTable workspace_standard_taxonomies
NodeTable workspace_standard_taxonomy_nodes
AttachmentTable workspace_standard_taxonomy_links
List filterGET …/standards?node= (includes subtree), ?uncategorized={taxonomyId}
Classification APIGET/POST …/standards/taxonomies, node CRUD, PUT …/taxonomy-links
FactoryFirst list (and later backfill) presets “region / industry / type / topic”; admins may create more index modes (not hard-coded)
Topic indexCross-region / industry theory (e.g. competency) hangs under “topic → generic / competency”
Admin pageRoute /workspace/standards; collaboration entry “Manage standards library”

Still pending: source-allowlist crawl, plugin subscribe by node, impact lists, and so on.


5. End-to-end flow

flowchart TD
  A[Official-site allowlist source] --> B[Work assistant or scheduled crawl]
  B --> C{Differs from published version?}
  C -->|no| D[Record check time]
  C -->|yes| E[Standards library draft / pending review]
  E --> F[Admin review]
  F -->|reject| G[Keep a trace]
  F -->|pass| H[Published + optional enable date]
  H --> I[Available to conversation retrieval]
  H --> J[Notify subscribed plugins]
  J --> K[Impact list and preview recalculation]
  K --> L[After human confirm, write plugin business store]

6. Plugin and cross-call boundaries

Agent ── retrieve ──────────────► Standards library (what the text says)
Agent ── plugin_invoke ─────► HR / compliance (what is in the store now)
HR / compliance ── read-only API ───────► Standards library (same source of truth)
Compliance ── platform-signed call ────────────► HR (business facts such as people only)
NeedCorrect approach
Several plugins share a lawAll read the standards library
HR generates grades from theoryRead published standards → preview → confirm into the store
Compliance generates a checklist from a lawSame
Compliance needs an employee’s departmentPlatform-signed HR business operation; do not impersonate from the HR knowledge tree
Plugin A needs full legal textCall the standards library, not plugin B

7. Implementation mapping

ConceptImplementation
Metadata tableworkspace_standards (SQLite / Postgres)
Body on disk{RuntimeDir}/workspaces/{id}/standards/{standardId}/draft.md and v{N}.md (package internal/standards); Markdown
Figures{…/standards/{standardId}/media/{file}; body uses relative media/xxx.png; POST/GET …/standards/{id}/media…
Member API (JWT)GET/POST /workspaces/{id}/standards, PATCH/GET …/{standardId}, GET …/content, POST …/media, `POST …/submit-review\publish\revoke\reopen; import/export POST …/standards/import, GET …/standards/export` (zip, see below)
Plugin read-only (launch_token)GET /platform-plugins/standards, …/{id}, …/{id}/content
SDK../../sdk/platform-plugin/go/standards.go; ../../sdk/platform-plugin/js listStandards / getStandard / getStandardContent
Publish permissionOnly workspace owner/admin may publish / revoke / reopen; import/export archive same permission
Member visibilityOrdinary members list/read only published and in the in-force window; admins see all statuses
Archivemanifest.json (kind=mindlink.workspace_standards) + taxonomies.json + `items/{dir}/item.json\content.md\media/* (package internal/standardsbundle). Incremental import (default on_conflict=incremental): match document number first, else title; skip if content hash matches; update if matched draft/pending review; do not overwrite published/repealed. on_conflict=create` always creates new.

Added (2026-07-25): Workspace collaboration UI “Standards library”; conversation runtime injects published standards (workspaceStandardsBlock).

Added (import/export): Full-screen admin “Import / Export”, same family as knowledge documents; on cross-workspace migrate, classification is rebuilt from slug + title path.

Added (agents writing article drafts): System tools workspace_standard_list / workspace_standard_write (user must confirm; draft only, no publish). Practice machine packs must not impersonate law with these tools; see 检查方案.md.

Still not implemented (later): Official-site allowlist and auto-crawl, plugin subscribe and impact lists, cross-plugin business signed calls, admin ops page.


8. Acceptance

8.1 Phase 1 (storage + draft/publish + plugin read-only) — API shipped

  • [x] Workspace members with JWT can create drafts and submit for review; admins can publish / repeal / reopen.
  • [x] Ordinary member lists see only published, in-force standards.
  • [x] Plugin launch_token reads published standards only (including filter by tag).
  • [x] Body is separate from the knowledge directory; publish writes a version file.

8.2 Multi-dimension index and admin UI — shipped

  • [x] Workspace presets region / industry / type indexes; tree nodes can be added and removed.
  • [x] The same standard can hang on multiple nodes under the current index; “Uncategorized” is visible.
  • [x] Full-screen admin: index switch + left tree + list + right editor; does not write knowledge-document physical paths.
  • [x] Publish gates and member/plugin visibility are not bypassed by tree browse.

8.3 Later

  • [ ] URLs outside the allowlist cannot write auto-crawl results.
  • [ ] Unpublished standards do not appear as the help assistant’s basis for ordinary members (conversation retrieval is partly covered; crawl path still pending).
  • [x] HR onboarding uses the product default machine-readable competency pack (does not scan the standards library); follow-up versions read one bound entry ID (mindlink-competency-pack, 2026-07-25); platform-level impact lists still pending.
  • [ ] After a new version is published, an impact list appears; the business store is not silently changed (HR already has “preview new standard → confirm apply”).
  • [ ] Can roll back a published version; audit can show “who crawled, who published, who confirmed recalculation”.

9. Revision history

DateNote
2026-07-25First draft: standards-library positioning, split from knowledge documents, crawl + human review, plugin subscribe, agents read published only
2026-07-25Phase 1 API: table workspace_standards, member CRUD/publish flow, plugin read-only, SDK
2026-07-25Added §4.7 multi-dimension index trees: region/industry browse; split from knowledge physical directories; full-screen three-pane UI intent
2026-07-25Index trees shipped: taxonomy tables and API, /workspace/standards three-pane admin, collaboration entry stub
2026-08-07Agents can write standards-library drafts: workspace_standard_list / workspace_standard_write (must confirm; no publish)
2026-08-06Product decision #13 (old): practice checklist → machine pack into the standards library; related 合规实践检查表转机读包.md
2026-08-07#13 corrected (option B): machine packs go to check schemes; standards library keeps articles only; see 检查方案.md
2026-08-05Zip import/export (modeled on knowledge documents; admins; import as draft; includes classification paths and figures)