Skip to content

capture_inbox_item writes invalid schema when no channel is provided (inbox.channel: null) #82

@projectious

Description

@projectious

Summary

The `capture_inbox_item` MCP tool writes `inbox.channel: null` into the Note's frontmatter when the optional `channel` parameter is omitted. The Note schema requires `channel` to be of type `string`, so `pk-doctor` immediately flags the freshly-created Note as an ERROR `schema.invalid`.

Repro

```json
capture_inbox_item(
title="Some title",
body="Some body",
tags=["tag1"],
source="somewhere"
// no channel
)
```

Result: Note created at `context/notes/2026/06/NOTE-….md` with:

```yaml
spec:
inbox:
status: captured
injection_mode: ambient
channel: null
captured_at: '...'
```

`pk-doctor` then reports:

```
ERROR schema.invalid
context/notes/.../NOTE-….md: inbox.channel: None is not of type 'string'
```

Expected

When no channel is provided, the tool should omit the `channel` field from frontmatter (or set it to a sentinel string like `"none"` / `"unspecified"`). The YAML serializer should not emit `null` for unset optional string fields when the schema disallows null.

Workaround

User has to either always pass a non-null channel, or hand-edit the frontmatter to delete the `channel: null` line — both violate the "use MCP tools, don't hand-edit context/" contract.

Hit during

`pk-resume` health-cleanup on 2026-06-06. Filed alongside #76, #77, #78, #79, #80, #81.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions