---
title: "LLM-assisted decomposition of a node into children (best-effort)"
method: POST
path: "/api/goal/decompose"
tags: ["Goal"]
---

# LLM-assisted decomposition of a node into children (best-effort)

`POST /api/goal/decompose`

## Request

- Base URL: `http://localhost:38200`
- URL: `http://localhost:38200/api/goal/decompose`
- Auth: one of:
  - HTTP bearer
  - API key in cookie `token`

Never throws when no LLM is configured — returns `{ proposed: [], applied: false, reason: 'llm_not_configured' }` so CRUD/import keep working without an LLM key.

## Request body

- object
  - `node_id` integer, required
  - `available_roles` string[]
  - `size` 'small' | 'medium' | 'large': Advisory decomposition granularity.

## Response `200`

Decomposition result.

- object
  - `proposed` object[]
  - `applied` boolean
  - `reason` string
  - `objectiveRunId` string, nullable

## Other responses

- `400`: Request body/query failed Zod validation.
- `401`: Missing or invalid credentials.
- `404`: Resource not found (or not visible to the caller).

---

[API](https://skmtc.dev/contextq/apis/contextq-api.md) · [All operations](https://skmtc.dev/contextq/apis/contextq-api/llms.txt) · [OpenAPI document](https://skmtc.dev/contextq/apis/contextq-api/revisions/7afc44056a22?raw)
