Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,10 @@ POWERCONTEXT_SERVER_DATABASE_KIND=sqlite
POWERCONTEXT_SERVER_RUNTIME_SOURCE_WINDOW_LIMIT=100
# Maximum sum of explicit assembly section limits; per-family limits still apply.
POWERCONTEXT_SERVER_RUNTIME_CONTEXT_ASSEMBLY_MAX_ENTRIES=8
# Maximum labels on one Artifact tag set, 1..256; applies to writes, Dream approval and merge selection.
POWERCONTEXT_SERVER_RUNTIME_TAG_MAX_PER_ARTIFACT=32
# Maximum labels in one tag query or filter, 1..64.
POWERCONTEXT_SERVER_RUNTIME_TAG_MAX_QUERY_LABELS=16
POWERCONTEXT_SERVER_RUNTIME_MEMORY_EXTRACTION_PROFILE=coding
POWERCONTEXT_SERVER_RUNTIME_MEMORY_SCHEDULE_SECONDS=60
POWERCONTEXT_SERVER_RUNTIME_TOPIC_MEMORY_SCHEDULE_SECONDS=60
Expand Down
34 changes: 34 additions & 0 deletions desktop/VALIDATION.md
Original file line number Diff line number Diff line change
Expand Up @@ -3991,3 +3991,37 @@ POWERCONTEXT_SERVER_ACCESS_MODE=enforced POWERCONTEXT_SERVER_AUTH_TOKEN=qualific
POWERCONTEXT_SERVER_SOURCE_CONTENT_MAX_CHARS=64 \
/tmp/pc-venv-limit7/bin/powercontext server run --host 127.0.0.1 --port 8246 --no-env-file
```

## Server b7399de tag limits protocol qualification

`sqlite-tag-limits-b7399de-v1` covers all thirteen Desktop protocol operations against Server source
`b7399deae0965226d4aa4bb4ebcb10adee5d2bbc`. The contract makes the per-Artifact and per-query tag limits deployment
settings, widens the candidate response contract to the same ceiling, rejects over-limit proposals and revisions before
they are stored, and applies the query limit to plugin listings without changing page sizes; the Desktop operations and
their request or response shapes are unchanged.

- Normalized OpenAPI SHA-256: `4a632917abc6a54f117d2c7dd299b105534a5cbe576f653750cf130ada1e69d5`.
- Wheel: `powercontext-0.1.dev2+gb7399deae-py3-none-any.whl`.
- Wheel SHA-256: `7e2d4630af1688bcfd9fa9e273b65575a6a76079198d34365e084916d72fc7ed`.

On 2026-11-29, Linux x86_64 (WSL2) with Python 3.14 and that wheel passed static Bearer mode with an enforced token:
unauthenticated requests returned 401, and the bundled Python client exercised all thirteen operations. The Server ran
with `POWERCONTEXT_SERVER_RUNTIME_TAG_MAX_PER_ARTIFACT=64` and `POWERCONTEXT_SERVER_RUNTIME_TAG_MAX_QUERY_LABELS=20`:
64 Artifact labels were accepted and 65 rejected with a `422` naming the limit; a 20-label tag query succeeded and a
21-label query was rejected with a `400` naming the limit; a 21-label Atomic Memory list filter was rejected with the
same `422` query-limit error.

The native `server_probe` was not rebuilt for this record because the validation environment has no Rust toolchain. This
record therefore establishes HTTP protocol compatibility between the new client contract and the exact wheel; it does not
establish native-probe, installed-WebView, Windows/macOS or release acceptance.

Reproduce against the recorded artifact:

```sh
uv build --wheel --out-dir /tmp/pc-wheel-tags7
uv pip install --python ~/pc-venv-tags/bin/python \
"/tmp/pc-wheel-tags7/powercontext-0.1.dev2+gb7399deae-py3-none-any.whl[server,cli]"
POWERCONTEXT_SERVER_ACCESS_MODE=enforced POWERCONTEXT_SERVER_AUTH_TOKEN=qualification-token \
POWERCONTEXT_SERVER_RUNTIME_TAG_MAX_PER_ARTIFACT=64 POWERCONTEXT_SERVER_RUNTIME_TAG_MAX_QUERY_LABELS=20 \
~/pc-venv-tags/bin/powercontext server run --host 127.0.0.1 --port 8250 --no-env-file
```
22 changes: 22 additions & 0 deletions desktop/src-tauri/src/connections/compatibility.json
Original file line number Diff line number Diff line change
Expand Up @@ -2102,5 +2102,27 @@
"search_memory"
],
"evidence": "desktop/VALIDATION.md#server-7b58ce2-source-content-limit-protocol-qualification"
},
{
"id": "sqlite-tag-limits-b7399de-v1",
"serverCommit": "b7399deae0965226d4aa4bb4ebcb10adee5d2bbc",
"contractSha256": "4a632917abc6a54f117d2c7dd299b105534a5cbe576f653750cf130ada1e69d5",
"artifactSha256": "7e2d4630af1688bcfd9fa9e273b65575a6a76079198d34365e084916d72fc7ed",
"operations": [
"get_access_principal",
"get_artifact_revision",
"get_capabilities",
"get_connection_identity",
"get_default_scope",
"get_liveness",
"get_readiness",
"get_scope",
"get_server_info",
"get_stats",
"list_scopes",
"remember_memory",
"search_memory"
],
"evidence": "desktop/VALIDATION.md#server-b7399de-tag-limits-protocol-qualification"
}
]
2 changes: 1 addition & 1 deletion desktop/src-tauri/src/transport/operations.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"contractSha256": "29f33308b74ff51bdd3d9825f85d7dd5a2308c80a476c6b1badf32a850e662f5",
"contractSha256": "4a632917abc6a54f117d2c7dd299b105534a5cbe576f653750cf130ada1e69d5",
"operations": {
"get_liveness": {
"method": "GET",
Expand Down
2 changes: 2 additions & 0 deletions desktop/src-tauri/src/transport/wire.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2880,6 +2880,7 @@ pub enum SubtreeScopeSelectionMode {
Subtree,
}

/// TagFilter : Exact label filter. The deployment's configured query-label limit, 16 by default, applies.
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize, TS)]
#[serde(deny_unknown_fields)]
pub struct TagFilter {
Expand All @@ -2891,6 +2892,7 @@ pub struct TagFilter {
}

impl TagFilter {
/// Exact label filter. The deployment's configured query-label limit, 16 by default, applies.
#[allow(clippy::too_many_arguments)]
pub fn new(tags: Vec<String>) -> TagFilter {
TagFilter {
Expand Down
3 changes: 2 additions & 1 deletion desktop/ui/src/generated/api.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5853,12 +5853,13 @@ export interface components {
entry_id: string;
};
TagTarget: components["schemas"]["ArtifactTagTarget"] | components["schemas"]["MemoryEntryTagTarget"];
/** @description Exact label filter. The deployment's configured query-label limit, 16 by default, applies. */
TagFilter: {
tags: string[];
/** @default all */
match: components["schemas"]["TagMatch"];
};
/** @description Replace all labels atomically. Empty clears the set. Labels preserve display text, use NFC then casefold for exact matching, and reject normalized duplicates, outer whitespace, and Unicode control, surrogate or unassigned characters. */
/** @description Replace all labels atomically. Empty clears the set. The deployment's configured Artifact tag limit, 32 by default, applies. Labels preserve display text, use NFC then casefold for exact matching, and reject normalized duplicates, outer whitespace, and Unicode control, surrogate or unassigned characters. */
ReplaceArtifactTagsRequest: {
tags: string[];
};
Expand Down
2 changes: 1 addition & 1 deletion desktop/ui/src/generated/operations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*/

// Generated from openapi/powercontext.yaml. Do not edit.
export const contractSha256 = "29f33308b74ff51bdd3d9825f85d7dd5a2308c80a476c6b1badf32a850e662f5";
export const contractSha256 = "4a632917abc6a54f117d2c7dd299b105534a5cbe576f653750cf130ada1e69d5";
export const operations = {
"get_liveness": {
"method": "GET",
Expand Down
10 changes: 7 additions & 3 deletions docs/en/docs/operate/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,11 @@ changes authoritative history. For a hosted decision backend, set `MEMORY_WRITE_
and explicitly select `MEMORY_WRITE_GATE_SANITIZER=known_secrets`. The sanitizer covers known sensitive environment/Codex
values and a bounded set of provider-key prefixes; it is not a general PII or password detector. The sanitizer selection
defaults to `none`, and hosted-redacted composition fails with a named configuration error until one is selected.
The existing limit of 32 tags per Artifact still applies to a merge result. When its inputs carry more than 32 distinct
normalized labels, the result keeps a deterministic selection of 32, and the merge and its Source window commit
normally. See [Organize with tags](../workflows/manage-artifact-tags.md#label-rules-and-storage) for the selection order.
The deployment's Artifact tag limit applies to a merge result. It is 32 tags by default and can be raised to 256 with
`POWERCONTEXT_SERVER_RUNTIME_TAG_MAX_PER_ARTIFACT`; the query-label limit is 16 by default and can be raised to 64 with
`POWERCONTEXT_SERVER_RUNTIME_TAG_MAX_QUERY_LABELS`. Both settings take effect on restart. Clients built from this contract
are required to read or write more than 32 labels; a client built from an earlier contract rejects them. When a merge's inputs carry more normalized labels than the effective
limit, the result keeps a deterministic selection of that size, and the merge and its Source window commit normally. See [Organize with tags](../workflows/manage-artifact-tags.md#label-rules-and-storage) for the selection order.

## User data

Expand Down Expand Up @@ -172,6 +174,8 @@ still occupies an HTTP slot until it finishes; reserve other slots for concurren
| `POWERCONTEXT_SERVER_DATABASE_BUSY_TIMEOUT_MS` | `5000` | Milliseconds a business connection waits for SQLite's single write lock before raising; it does not govern usage accounting, which has its own bounded budget |
| `POWERCONTEXT_SERVER_RUNTIME_SCOPE_CACHE_SIZE` | `128` | Inactive scope compositions retained by the Runtime; in-flight scopes are never evicted |
| `POWERCONTEXT_SERVER_RUNTIME_SOURCE_WINDOW_LIMIT` | `100` | Maximum Source journal positions per activation; Memory reduces its window after generation timeouts |
| `POWERCONTEXT_SERVER_RUNTIME_TAG_MAX_PER_ARTIFACT` | `32` | Effective maximum labels on one Artifact tag set; `1` to `256`. Applies to tag replacement, Dream/catalog approval and merge selection |
| `POWERCONTEXT_SERVER_RUNTIME_TAG_MAX_QUERY_LABELS` | `16` | Effective maximum labels in one tag query or filter; `1` to `64`. Applies to tag queries and Artifact or Memory tag filters |
| `POWERCONTEXT_SERVER_RUNTIME_CONTEXT_ASSEMBLY_MAX_ENTRIES` | `8` | Maximum sum of explicit `assembly.sections[].limit`; positive integer. Per-family limits still apply. |
| `POWERCONTEXT_SERVER_RUNTIME_MEMORY_EXTRACTION_PROFILE` | `coding` | Memory selection policy: `coding` or `conversation` |
| `POWERCONTEXT_SERVER_RUNTIME_MEMORY_RERANK_ENABLED` | `false` | Apply listwise reranking after coarse Memory retrieval |
Expand Down
9 changes: 6 additions & 3 deletions docs/en/docs/workflows/manage-artifact-tags.md
Original file line number Diff line number Diff line change
Expand Up @@ -113,16 +113,19 @@ does not freeze a snapshot across requests.

## Label rules and storage

- A target holds at most 32 labels; a filter accepts 1–16 labels.
- A target holds at most the deployment's Artifact tag limit: 32 labels by default, configured with
`POWERCONTEXT_SERVER_RUNTIME_TAG_MAX_PER_ARTIFACT` (1–256). A filter accepts 1 label up to the deployment's
query-label limit: 16 by default, configured with `POWERCONTEXT_SERVER_RUNTIME_TAG_MAX_QUERY_LABELS` (1–64).
- Each label has 1–64 Unicode code points, no outer whitespace, and no control, surrogate, or unassigned characters.
- Matching uses NFC normalization followed by Unicode case folding. The submitted display spelling is retained.
Normalized duplicates such as `Straße` and `STRASSE` are rejected atomically. A normalized key may not exceed 128
code points.
- Tags are Scope-local discovery metadata, not permissions or trusted instructions. They are not added to model prompts,
Skill package frontmatter, or publication/import payloads. Published copies start without the source target's tags.
- Inactive memories retain their authoritative tags. Rebuilding active search projections does not delete them.
- A merge result starts with tags drawn from its inputs. When the inputs carry more than 32 distinct normalized labels,
the result keeps 32: labels carried by more inputs first, then code point order of the normalized key. The selection
- A merge result starts with tags drawn from its inputs. When the inputs carry more normalized labels than the effective
Artifact limit, the result keeps that many: labels carried by more inputs first, then code point order of the normalized
key. The selection
does not depend on input order, so repeating the same merge assigns the same tags. The merged inputs keep their
complete tag sets, and restoration makes them active with those tags.

Expand Down
2 changes: 2 additions & 0 deletions docs/en/docs/workflows/review-dream-revisions.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,8 @@ async def propose_tags(client, scope_id, current, tags_etag, evidence_source_id)

Atomic Memory uses `ArtifactTagTarget(family="atomic-memory", ...)` and the exact `basis_ref`, just like other Artifacts. Its target is comparison context and cannot support its own Tag change; supply independent evidence. The resulting run has `candidate.kind="tag"`. Inspect it using `get_candidate(GetCandidateRequest(...))`; approval uses `approve_candidate(ApproveCandidateRequest(...))`. The unified `/v1/candidates/list|get|history|revise|approve|reject` interfaces preserve Tag's distinct lifecycle. Approval checks both the Tag ETag and content baseline atomically. The result contains the complete tags and new ETag, with no Artifact revision.

An over-limit Dream Tag proposal fails its run with `invalid_generation_output` and creates no candidate. A revise, or an approval of a candidate created before the limit was lowered, whose `after_tags` exceeds the deployment's effective Artifact tag limit returns `422 invalid_request` with `details.field="after_tags"`, `details.reason="tag_limit_exceeded"` and the effective `details.limit`; an embedded `catalog_changes.propose` caller gets `InvalidCandidateError`. Approval leaves the target unchanged.

```sh
powercontext candidate list --candidate-kind tag --scope-id "$SCOPE_ID"
powercontext candidate show --scope-id "$SCOPE_ID" "$CANDIDATE_ID"
Expand Down
2 changes: 1 addition & 1 deletion docs/en/rfcs/1467_artifact_tags.md
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ A submitted tag must satisfy all of the following:
- it has no leading or trailing whitespace;
- it contains no Unicode control, surrogate, or unassigned code point;
- its normalized key is at most 128 Unicode code points; and
- the complete submitted set contains at most 32 tags.
- the complete submitted set contains at most the deployment's effective Artifact tag limit (32 by default, ceiling 256).

PowerContext preserves the submitted value as `tag` for display. It computes `tag_key` by applying Unicode NFC and
then Unicode default case folding. It does not collapse internal whitespace, split punctuation, parse `/`, translate,
Expand Down
2 changes: 1 addition & 1 deletion docs/en/rfcs/1715_multi_artifact_dreaming.md
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ For a Memory entry, use a target with type=memory_entry, family=memory, artifact
| `/v1/candidates/approve` | scope_id, candidate_id, expected_version | Conditional Tag replacement and stored result |
| `/v1/candidates/reject` | scope_id, candidate_id, expected_version, reason | Terminal rejection without changing tags |

Reads require scope.read; review mutations require scope.review and applicable target permissions. The complete proposal retains the original target, expected_etag, basis, and before_tags. Revision must not change those fields to bypass a conflict. after_tags contains the entire replacement set: 0–32 labels, each 1–64 characters. An empty set clears the tags. Apply NFC/casefold normalization and reject duplicates after normalization.
Reads require scope.read; review mutations require scope.review and applicable target permissions. The complete proposal retains the original target, expected_etag, basis, and before_tags. Revision must not change those fields to bypass a conflict. after_tags contains the entire replacement set: 0 to the deployment's effective Artifact tag limit (32 by default, ceiling 256) labels, each 1–64 characters. An empty set clears the tags. Apply NFC/casefold normalization and reject duplicates after normalization.

Example request to `/v1/candidates/revise`:

Expand Down
10 changes: 8 additions & 2 deletions docs/zh/docs/operate/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,12 @@ MemoryWriteGate 采用 fail-open 策略,只裁决写入,不修改权威历
`MEMORY_WRITE_GATE_PRIVACY_BOUNDARY=hosted_redacted` 和显式的 `MEMORY_WRITE_GATE_SANITIZER=known_secrets`。
内置 sanitizer 覆盖已知的敏感环境变量/Codex 值及有限的 provider 前缀,不是通用的 PII 或口令检测器。sanitizer
默认是 `none`;hosted-redacted 组合在未选择 sanitizer 时会以命名配置错误失败。
合并结果仍遵守每个 Artifact 最多 32 个标签的限制。输入标签按规范化键去重后超过 32 个时,结果保留确定性选出的 32 个,
合并及其 Source 窗口照常提交。选择顺序见[使用标签整理内容](../workflows/manage-artifact-tags.md#标签规则与存储)。
合并结果遵守部署的 Artifact 标签上限:默认 32 个,可通过
`POWERCONTEXT_SERVER_RUNTIME_TAG_MAX_PER_ARTIFACT` 提高到 256;查询标签上限默认 16,可通过
`POWERCONTEXT_SERVER_RUNTIME_TAG_MAX_QUERY_LABELS` 提高到 64。两个设置都在重启后生效。
要读写超过 32 个标签,客户端必须使用当前契约构建;旧契约构建的客户端会拒绝这些数据。
输入标签按规范化键去重后超过生效上限时,结果保留确定性选出的该上限数量,合并及其 Source 窗口照常提交。
选择顺序见[使用标签整理内容](../workflows/manage-artifact-tags.md#标签规则与存储)。

## 用户数据

Expand Down Expand Up @@ -156,6 +160,8 @@ MCP 使用 stateless Streamable HTTP,每次工具执行都采用当前请求
| `POWERCONTEXT_SERVER_DATABASE_BUSY_TIMEOUT_MS` | `5000` | 业务连接等待 SQLite 单一写锁的毫秒数;它不约束用量记账,后者有自己的有界预算 |
| `POWERCONTEXT_SERVER_RUNTIME_SCOPE_CACHE_SIZE` | `128` | Runtime 保留的非活动 scope composition 数量;进行中的 scope 不会被驱逐 |
| `POWERCONTEXT_SERVER_RUNTIME_SOURCE_WINDOW_LIMIT` | `100` | 每次处理的 Source 日志位置上限;Memory 在生成超时后会缩小窗口 |
| `POWERCONTEXT_SERVER_RUNTIME_TAG_MAX_PER_ARTIFACT` | `32` | 单个 Artifact 标签集的生效上限,取值 `1` 到 `256`;适用于标签替换、Dream/Catalog 审批和合并选标签 |
| `POWERCONTEXT_SERVER_RUNTIME_TAG_MAX_QUERY_LABELS` | `16` | 单次标签查询或过滤的生效上限,取值 `1` 到 `64`;适用于标签查询以及 Artifact、Memory 标签过滤 |
| `POWERCONTEXT_SERVER_RUNTIME_CONTEXT_ASSEMBLY_MAX_ENTRIES` | `8` | 显式 `assembly.sections[].limit` 之和的上限;正整数,各类别单独上限仍适用 |
| `POWERCONTEXT_SERVER_RUNTIME_MEMORY_EXTRACTION_PROFILE` | `coding` | Memory 选择策略:`coding` 或 `conversation` |
| `POWERCONTEXT_SERVER_RUNTIME_MEMORY_RERANK_ENABLED` | `false` | 在 Memory 粗召回后应用 listwise rerank |
Expand Down
6 changes: 4 additions & 2 deletions docs/zh/docs/workflows/manage-artifact-tags.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,14 +108,16 @@ Atomic Memory 的 list/search 接口使用如下标签字段:

## 标签规则与存储

- 每个对象最多 32 个标签;一次过滤接受 1–16 个标签。
- 每个对象最多容纳部署的 Artifact 标签上限:默认 32 个,可通过
`POWERCONTEXT_SERVER_RUNTIME_TAG_MAX_PER_ARTIFACT`(1–256)配置。一次过滤接受 1 个到部署的查询标签上限:
默认 16 个,可通过 `POWERCONTEXT_SERVER_RUNTIME_TAG_MAX_QUERY_LABELS`(1–64)配置。
- 每个标签包含 1–64 个 Unicode 码点,首尾不能有空白,不能包含控制字符、代理字符或未分配字符。
- 匹配键由 NFC 规范化后再执行 Unicode case folding 得到,显示文字保留原始写法。
`Straße` 和 `STRASSE` 等规范化后重复的标签会让整次请求失败;规范化键不能超过 128 个码点。
- 标签是 Scope 内的检索元数据,不是权限或可信指令,不会进入模型提示词、Skill 包 frontmatter 或发布/导入内容。
发布后的副本不会继承源对象的标签。
- 非在役记忆的标签仍保留在权威标签表中;重建搜索投影不会删除这些标签。
- 合并结果的初始标签取自各输入。输入标签按规范化键去重后超过 32 个时,结果只保留 32 个:先选被更多输入共同携带的标签,
- 合并结果的初始标签取自各输入。输入标签按规范化键去重后超过生效上限时,结果只保留该上限数量的标签:先选被更多输入共同携带的标签,
再按规范化键的 Unicode 码点顺序补足。选择结果与输入顺序无关,重复同一合并会得到相同标签。被合并的输入保留完整标签,
恢复后带着这些标签重新进入在役状态。

Expand Down
Loading
Loading