---
title: "Knowledge Config Patch"
method: PATCH
path: "/api/projects/{project_id}/knowledge/config"
tags: ["Projects", "Knowledge"]
---

# Knowledge Config Patch

`PATCH /api/projects/{project_id}/knowledge/config`

## Request

- Base URL: `https://api.agentstack.tech` (the document declares no server; this is the origin it was published from)
- URL: `https://api.agentstack.tech/api/projects/{project_id}/knowledge/config`
- Auth: one of:
  - API key in header `X-API-Key`
  - HTTP bearer

## Path parameters

- `project_id` integer, required

## Headers

- `Idempotency-Key` string

## Request body

- KnowledgeConfigPatch: Writable knowledge DNA fields (GET-only metadata excluded). Shared by knowledge + mentor PATCH.
  - `support_url` string, nullable
  - `contacts` KnowledgeSupportContacts: Operator-editable help targets. Primary URL is used in channel abstain.
    - `conversation_url` string
    - `label_ru` string
    - `label_en` string
    - `telegram_url` string
    - `email` string
  - `moderator_user_ids` integer[], nullable
  - `safety_playbooks` object, nullable
  - `safety_playbooks_write_mode` 'replace' | 'patch' | 'merge', nullable: How to apply safety_playbooks: replace (full dict, UI default), patch (per-playbook overlay, MCP default), merge (policy-safe fill only).
  - `crisis_playbooks` object, nullable
  - `min_rag_score` number, nullable
  - `grounded_first` boolean, nullable
  - `safety_fail_mode` 'fail_open' | 'fail_closed_crisis', nullable
  - `safety_term_allowlist` string[], nullable
  - `retention_days` integer, nullable
  - `llm_primary` string, nullable
  - `llm_fallback` string, nullable
  - `plan_history_enabled` boolean, nullable
  - `plan_history_max_user_messages` integer, nullable
  - `slo_p95_ms` integer, nullable
  - `max_concurrent_runs` integer, nullable
  - `hyde_enabled` boolean, nullable
  - `term_aliases` object, nullable
  - `gene_pack` KnowledgeGenePack: Project genetic dictionary + FAQ phenotypes (8DNA blob).
    - `version` integer
    - `program_stems` string[]: Term-lock / gene-lock vocabulary (replaces hardcoded PROGRAM_FOCUS_STEMS).
    - `aliases` object: Query substring → rewrite (merged with KnowledgeConfig.term_aliases).
    - `lexicon` object
    - `phenotypes` FaqPhenotype[]
      - `name` string, required
      - `all_of` string[]
      - `any_of` string[]
      - `none_of` string[]
      - `retrieve` string
      - `boost_idents` string[]
      - `penalize_idents` string[]
      - `skip_without_lock` boolean
      - `penalize_bg_vs` boolean
      - `penalize_noise` boolean
      - `noise_unless_asked` boolean
      - `covers_all` string[]
      - `covers_any` string[]
      - `heading_needles` string[]
      - `penalize_heading_needles` string[]
      - `drop_sentence_stems` string[]
      - `retrieve_expand` string
    - `pinned_shapes` PinnedShapeBinding[]: Phenotype → glossary stem bindings for fixture shape replies.
      - `phenotype` string, required
      - `glossary_stem` string, required
      - `extract_mode` string: section | quote | full | lesson_link — fixture extract strategy.
      - `section_heading` string
      - `section_headings` string[]: Ordered ## heading prefixes; overrides single section_heading when set.
      - `section_body_needle` string: When set, extracted section body must contain this substring.
      - `append_lesson_link` boolean: After section/quote/full body, append inline lesson URL from the same card.
    - `fixture_shape_hints` FixtureShapeHint[]: Query-needle hints → extra fixture phenotypes (tenant MCP tuning).
      - `phenotype` string, required
      - `query_any_of` string[]
      - `query_all_of` string[]
    - `rerank_off_query_guards` RerankOffQueryGuard[]: Rerank/extractive penalties when card matches but query lacks stems.
      - `snippet_ident_contains` string
      - `heading_any_of` string[]
      - `require_query_any_of` string[]
    - `sanitize_drop` string[]: Tenant operator-voice phrases to drop from channel replies.
    - `skip_asked_stems` string[]: If the query names these stems, skip-Plan extractive must contain one. Tenant SoT — not hardcoded in Core retrieve.
    - `situational_needles` string[]: Applied-ask needles (union with fixture query_intent_needles_v1). Tenant SoT — not a Core regex table.
  - `context_map_enabled` boolean, nullable
  - `crag_enabled` boolean, nullable
  - `use_assistant_pipeline` boolean, nullable
  - `collection_ids` string[], nullable
  - `context_lanes` ContextLane[], nullable
    - `id` 'faq' | 'consult' | 'coding' | 'design' | 'architecture', required
    - `collection_ids` string[]
    - `preamble` string
  - `context_limits` ContextLimits: Operating caps on ``config.knowledge``. Agents patch this; hot paths do not hardcode sizes.
    - `prompt_tail_chars` integer
    - `lane_preamble_chars` integer
    - `builder_snippet_chars` integer
    - `description_chars` integer
    - `resource_text_chars` integer
    - `evidence_snippet_chars` integer
    - `lane_collection_cap` integer
  - `skill_subscriptions` SkillSubscription[], nullable
    - `publisher_project_id` integer
    - `skill_id` string, required
    - `source_doc_id` string
  - `entitlement_sources` string[], nullable
  - `getcourse_cache_ttl_sec` integer, nullable
  - `product_id_map` object, nullable
  - `allowed_link_domains` string[], nullable
  - `onboarding_email_prompt_ru` string, nullable
  - `require_email_for_paid` boolean, nullable
  - `crisis_notify_webhook_url` string, nullable
  - `default_playground_bot_uuid` string, nullable
  - `safety_reactions` object, nullable
  - `moderator_hours_msk` MentorHoursMsk
    - `start` integer
    - `end` integer
    - `weekdays_only` boolean
  - `handoff_sla_minutes` integer, nullable

## Response `200`

Successful Response

- object

## Other responses

- `400`: Bad Request
- `401`: Unauthorized
- `403`: Forbidden
- `404`: Not Found
- `409`: Conflict
- `422`: Validation Error
- `429`: Too Many Requests
- `500`: Internal Server Error

---

[API](https://skmtc.dev/agentstack/apis/agentstack-core-api.md) · [All operations](https://skmtc.dev/agentstack/apis/agentstack-core-api/llms.txt) · [OpenAPI document](https://skmtc.dev/agentstack/apis/agentstack-core-api/revisions/79f4a4dd8813?raw)
