Workspace knowledge
Workspace knowledge is the organization-wide knowledge tier that gives agent turns a shared view of the company, its team, and connected integrations. Background scans create it, member-only reads expose it to prompts and tools, and the CLI, shell, Slack, and web app provide operator views over the same source. It complements agent execution and is separate from agent memory, which belongs to one member.
Knowledge model
Shared knowledge tier
Workspace knowledge describes facts that can apply to the whole organization. The organization entry carries the main profile, while integration entries describe connected systems such as Slack. Personal facts and preferences stay in the member's own memory and do not enter this tier.
References: core/…/__init__.py• L1-11 core/…/store.py• L1-13 tools/…/workspace.py• L1-6
Entry boundaries
The two memory tiers use the same record and search model but have different ownership. Workspace writes accept shared or scan-owned types and reject personal types, so a fact saved for one member cannot become organization knowledge by accident.
References: core/…/store.py• L21-39 core/…/store.py• L82-109 tests/…/test_workspace_knowledge.py• L69-103
Access boundary
Membership gate
Only a full member of the organization may read workspace knowledge in an organization-bound turn. Slack guests, Slack Connect users from another organization, and users not listed by a completed member scan receive no workspace entries, even when the surrounding workspace is open.
App members and the organization's own control-plane actor are admitted through their trusted actor identity. A laptop turn with no organization scope is treated as the operator's own local context. A child CLI process keeps the actor and organization from its parent turn, so it cannot use the host process as an access bypass.
References: core/…/access.py• L1-19 core/…/access.py• L83-105 tests/…/test_workspace_access.py• L47-98
Availability gates
The feature follows the long-term memory gate and can be disabled with OPENSRE_KNOWLEDGE_DISABLED=1. When it is unavailable, scans, prompt blocks, recall results, and operator reads do not expose workspace knowledge. Message sampling is a separate choice controlled by OPENSRE_KNOWLEDGE_SCAN_MESSAGES; metadata scans can still run with message reading off.
References: core/…/settings.py• L18-38 config/…/knowledge.py• L11-25 core/…/reading.py• L21-37
Knowledge storage
Workspace store
The organization store lives in the configured knowledge directory beside member memory stores. It uses the shared memory engine for safe records, ranking, locks, and cache invalidation. Read helpers do not create the store, while scan and synchronization writers create it when needed.
References: core/…/store.py• L1-13 core/…/store.py• L47-79 core/…/store.py• L112-123
Record provenance
Each entry keeps a source, evidence, verification state, description, timestamps, and body. Integration scans mark their facts as scan output and retain evidence about the source data. Safety checks can reject credentials or secret-shaped content before it becomes shared knowledge.
References: core/…/store.py• L82-109 integrations/…/knowledge_scan.py• L461-489
Integration scanning
Scan lifecycle
The scan service keeps connected integration knowledge current in the background. A scan runs when an entry is missing, older than the refresh age, or explicitly requested; a failed scan keeps the last good entries and retries with increasing delay. Reader membership refreshes more often than the full content scan, so access changes do not wait for the next weekly content refresh.
The gateway owns one scan loop for its organization. A request from a gateway turn wakes that loop instead of running network calls inside the chat turn. A standalone CLI process runs the requested scan itself when no loop is installed.
The following flow shows how source data becomes shared knowledge and reaches operator surfaces.
flowchart LR
I[Connected integration] --> S[Background scan service]
S --> R[Workspace knowledge store]
R --> P[Prompt and memory recall]
R --> O[CLI and shell views]
R --> W[Web app mirror]
O --> Q[Rescan request]
W --> Q
Q --> S
References: integrations/…/service.py• L1-19 integrations/…/service.py• L130-172 integrations/…/service.py• L253-273 config/…/knowledge.py• L19-25
Scanner registry
The registry gives each connected integration one common contract: availability, entries it writes, optional reader refresh, and the scan operation. Slack is the current registered scanner, but the service treats the integration name as the scheduling and status boundary.
References: integrations/…/registry.py• L1-26 integrations/…/registry.py• L29-58
Slack source scope
The Slack scan builds two shared views: an organization profile and a public channel map. It reads workspace identity, full members, and public channel metadata. Optional message sampling is limited to recent human messages in public channels where the bot is a member; private channels, direct messages, group DMs, guest accounts, bots, and Slack Connect channel messages are excluded.
Slack-authored fields and sampled messages are capped and redacted before the summary model sees them. A complete read writes both entries with scan evidence. If a required read or summary fails, the last good knowledge remains in place rather than being replaced by an empty or partial view.
References: integrations/…/knowledge_scan.py• L1-26 integrations/…/knowledge_scan.py• L200-263 integrations/…/knowledge_scan.py• L274-321 integrations/…/knowledge_scan.py• L436-504
Prompt rendering
Cached workspace context
The prompt carries a stable workspace block when the turn may read it. That block includes the organization profile in full up to its context limit and a compact index of other entries. File signatures make the block reusable until a scan changes an entry, which protects prompt-cache reuse.
References: core/…/render.py• L27-72 core/…/assemble.py• L501-523
Relevant workspace context
The turn adds full text for the few workspace entries that best match the request. The organization profile is not repeated because it is already in the cached block, and workspace matches are not marked as used or aged by the request. Long-term memory must be enabled for both workspace prompt blocks.
References: core/…/render.py• L74-92 core/…/assemble.py• L525-544 tests/…/test_workspace_knowledge.py• L117-144
Recall results
The memory_recall tool keeps personal results under memories and shared results under workspace. An operator or agent can list the workspace index, open one named entry, or search shared entries by relevance without confusing an organization fact with something one member said.
References: tools/…/workspace.py• L28-60 tools/…/tool.py• L198-263
Operator surfaces
CLI path
opensre knowledge is the direct operator interface for local or hosted processes. It lists personal and readable workspace entries, shows one entry in full with provenance, requests integration scans, and audits memory quality. Human output is concise text; JSON mode gives structured records for scripts and automation.
The command checks the same availability and membership rules as a turn. When an agent starts the CLI as a child process, the child is judged as the initiating turn's actor.
References: surfaces/…/knowledge.py• L1-7 surfaces/…/knowledge.py• L67-147 tests/…/test_workspace_access.py• L86-98
Shell path
The interactive shell exposes the same knowledge view through /knowledge. Operators can list entries, show one entry, audit their own memory, or request a scan for all or one connected service. The shell uses shared text formatting with the CLI, and a gateway shell hands scan requests to the background service rather than blocking the chat turn.
The shell keeps /memory as the personal-memory path. A member check runs before workspace list, show, and scan actions, so a guest sees a clear access message instead of shared content.
References: surfaces/…/knowledge_cmds.py• L1-7 surfaces/…/knowledge_cmds.py• L29-94 surfaces/…/knowledge_text.py• L1-59
Slack turn path
Slack operators use the same member-bound turn path as other gateway users. The prompt and memory_recall can provide shared entries, while /knowledge can list, show, or request a scan from the Slack conversation surface. The scan itself acts for no individual and therefore limits its source to information that a full organization member could see.
References: core/…/access.py• L1-18 core/…/reading.py• L1-37 surfaces/…/knowledge_cmds.py• L77-100 integrations/…/knowledge_scan.py• L14-26
Web application synchronization
Knowledge mirror
The gateway is the source of truth for the web app's Knowledge page. It sends one organization-scoped mirror containing shared entries, member memory summaries, audit counts, and recent scan status. The report is size-bounded, keeps organization-wide counts even when detail must be reduced, and exposes personal memory detail only under its member actor.
The mirror is sent after changes and on a heartbeat. A generation check lets a newly saved memory or workspace entry reach the page within the next short check instead of waiting for the full sync interval.
References: integrations/…/snapshot.py• L1-13 integrations/…/snapshot.py• L325-361 integrations/…/sync.py• L1-17 integrations/…/sync.py• L165-182 integrations/…/sync.py• L233-257
Web app requests
The web app can ask the gateway to forget a member's memory, delete a workspace entry, or rescan an integration. Delivery is at least once, so the gateway records an outcome in a local ledger before acknowledging the request. A failed store operation or unavailable ledger leaves the request pending and avoids falsely reporting a change as complete.
References: integrations/…/sync.py• L114-163 integrations/…/sync.py• L198-231 tests/…/test_webapp_knowledge.py• L242-310
Local repository inspection
Git workspace scan
The scan_local_git_workspace action is a separate read-only operator aid, not a writer of shared workspace knowledge. It searches a local root for Git checkouts and reports recent commit activity, the operator's own commits, uncommitted files, GitHub origin names, and GitHub Actions workflow presence.
The default root is the home directory with large or privacy-protected folders skipped. The scan is bounded by depth, repository count, Git call timeouts, and a total time budget. It can stop on Escape, reports partial results clearly, and may reuse a matching background prefetch started before the action call.
References: tools/…/tool.py• L193-227 tools/…/scan.py• L187-230 tools/…/skips.py• L15-33 tools/…/prefetch.py• L1-49
Git workspace rendering
The shell rendering presents repository counts and a compact activity chart. The result remains an in-memory snapshot and analytics record; it does not become an organization entry, prompt block, or web app knowledge record.
References: tools/…/render.py• L1-39 tools/…/tool.py• L256-285
Change checklist
When these files or sections are changed, remember to consider these:
- Keep a scanner's declared
writesset aligned with every entry it creates. Missing one silently prevents the service from refreshing a deleted entry. - Preserve the actor IDs recorded by reader refreshes when changing Slack membership filters. The prompt, recall tool, CLI, and shell all rely on the same reader set.
- Keep
organizationand integration slug naming aligned across scan output, prompt rendering, CLI lookup, web app reports, and delete requests. - Preserve the split between the cached workspace block and per-turn relevant entries. Repeating the organization profile can waste context and break prompt-cache reuse.
- Keep web app request outcomes in the ledger before acknowledgements. At-least-once delivery otherwise risks applying a member request twice.
- Keep local Git scan output separate from the workspace knowledge store. A repository snapshot is current operator context, not shared organizational memory.
Important failure modes
| Trigger | Consequence | Guard |
|---|---|---|
| Caller is a Slack guest, external Connect user, or unlisted actor | Prompt, recall, CLI, and shell reads return no workspace knowledge | Reader records and caller_may_read_workspace enforce full-member access |
| Memory or workspace knowledge is disabled | Scans and all workspace read paths are unavailable | knowledge_enabled and knowledge_available_here gate every path |
| Slack member or channel metadata read fails | Existing entries stay in place and the scan retries instead of erasing knowledge | Required source reads fail the scan before writes |
| Slack summary model fails after a good profile exists | The prior organization overview is retained and the scan reports failure | Failed summaries are not treated as empty summaries |
Gateway receives /knowledge scan or a web app rescan | The request is queued for the background scan loop, not completed in the current turn | Operators must read the returned queued status and wait for the next scan result |
| Web app ledger or store write fails | The request remains pending or unacknowledged; the page is not told it succeeded | Outcome recording precedes acknowledgement and locked writes are retried |
| Local Git scan reaches its time, repository, or cancellation limit | The operator sees a partial or cancelled snapshot, not a full repository inventory | Snapshot stop state and rendering notes identify the limit |
Key files
| File | Why to read it |
|---|---|
| core/…/access.py | Defines who may read organization knowledge and how reader records are refreshed. |
| core/…/store.py | Defines the shared store boundary and the distinction between personal and workspace entry types. |
| core/…/render.py | Shows the cached and request-specific views given to the model. |
| integrations/…/service.py | Explains scan scheduling, retries, reader refresh, and gateway versus standalone execution. |
| integrations/…/knowledge_scan.py | Shows the source scope, safety rules, and shared entries produced from Slack. |
| surfaces/…/knowledge.py and surfaces/…/knowledge_cmds.py | Define the operator commands and their CLI/shell behavior. |
| tools/…/workspace.py and tools/…/tool.py | Define how shared entries appear beside personal memory in agent recall. |
| integrations/…/sync.py and integrations/…/snapshot.py | Define the web app mirror, request handling, size limits, and acknowledgement contract. |
| tools/…/tool.py and tools/…/scan.py | Define the separate local repository inspection path and its bounded scan behavior. |