Skip to main content

Read one learned rule or skill

GET 

/session/learned/file

Returns one learned rule's file, or one learned skill's SKILL.md, as the agent saved it, with the same metadata the list returns. Name the file with scope, kind, and name.

A file larger than 128 KiB, which the harness skips, comes back with empty content and an estimatedTokens of 0.

  • Select the session with the X-Session-ID header.
  • Returns 400 with code VALIDATION_FAILED when name has an empty, ., or .. segment, contains a backslash, or is nested too deep (a skill name is one segment; a rule name is at most 9).
  • Returns 404 with code SESSION_NOT_FOUND when the session does not exist, and 404 with code NOT_FOUND (learned file not found) when the deployment has no global learned directory (for scope=global), or the file does not exist, is not a regular file, or resolves outside its learned directory through a symbolic link.

Request​

Responses​

The learned file's metadata and text.

Response Headers
    X-Session-ID

    The session this response belongs to. For session-scoped requests it echoes the X-Session-ID request header; for POST /sessions/open and POST /sessions/system it is the session that was opened or created.

    X-Request-ID

    The request's correlation ID. When the request carried an X-Request-ID header holding a UUID, Peen echoes it; otherwise Peen generates a new UUID. The controller log records the same value for this request.