# Get bounded project AI context

> Returns authorized unassigned task and unlinked resource candidates for project organization.

`GET /projects/profiles/{studioId}/{projectId}/ai-context`

## OpenAPI

````yaml openapi/agata-v1.yaml get /projects/profiles/{studioId}/{projectId}/ai-context
openapi: 3.0.3
info:
  title: Agata canonical API
  version: 1.0.0
  description: Canonical contract of the Agata Go API. Every documented route is
    registered in internal/delivery/http/handler.go. Monetary amounts are
    expressed in cents and local date keys use YYYY-MM-DD.
servers:
  - url: http://localhost:{port}/api
    description: Local server
    variables:
      port:
        default: "8080"
        description: Local HTTP port
  - url: "{scheme}://{host}/api"
    description: Configurable server
    variables:
      scheme:
        default: https
        enum:
          - http
          - https
      host:
        default: api.example.com
tags:
  - name: Health check
    description: Health-check operations.
  - name: Users
    description: Users domain operations.
  - name: Profiles
    description: Studio domain operations.
  - name: Organizations
    description: Company accounts that own people and Studios. Not followable.
  - name: Public profiles
    description: Public studio reads and one-way follows. Membership is not required.
  - name: Membership
    description: Studio membership plans, Connect status, and fan subscriptions.
  - name: Messages
    description: 1:1 owner chat between a studio owner and a subscriber with the
      owner_chat perk.
  - name: Feedback
    description: Feedback domain operations.
  - name: Internal system
    description: Internal system operations.
  - name: AI capabilities
    description: Durable leases, outcomes, and reversible effects for integrated AI actions.
  - name: Finance
    description: Finance domain operations.
  - name: Goals
    description: Goals domain operations.
  - name: Pomodoro
    description: Pomodoro domain operations.
  - name: Activities
    description: Activities domain operations.
  - name: Calendar
    description: Calendar domain operations.
  - name: Library
    description: Library domain operations.
  - name: Health
    description: Health domain operations.
  - name: Nutrition
    description: Nutrition domain operations.
  - name: Notebook
    description: Notebook domain operations.
  - name: Week plan
    description: Week-plan domain operations.
  - name: Files
    description: Files domain operations.
  - name: Tags
    description: Tags domain operations.
  - name: Tasks
    description: Tasks domain operations.
  - name: Projects
    description: Projects domain operations.
  - name: Internal
    description: Internal integrations protected by Bearer session.
  - name: Internal cron
    description: Internal cron operations.
paths:
  /projects/profiles/{studioId}/{projectId}/ai-context:
    get:
      tags:
        - Projects
      operationId: getProjectAIContext
      summary: Get bounded project AI context
      description: Returns authorized unassigned task and unlinked resource candidates
        for project organization.
      security:
        - sessionBearer: []
      parameters:
        - $ref: "#/components/parameters/AIStudioId"
        - $ref: "#/components/parameters/AIProjectId"
      responses:
        "200":
          description: Project context and bounded candidates.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/AIProjectContextResponse"
        "400":
          $ref: "#/components/responses/BadRequest"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "404":
          $ref: "#/components/responses/NotFound"
        "500":
          $ref: "#/components/responses/ServerError"
components:
  parameters:
    AIStudioId:
      name: studioId
      in: path
      required: true
      description: Studio identifier used for authorization and operation scope.
      schema:
        type: string
        format: uuid
    AIProjectId:
      name: projectId
      in: path
      required: true
      schema:
        type: string
        format: uuid
  schemas:
    AIProjectTaskCandidate:
      type: object
      required:
        - id
        - name
        - status
        - priority
        - updatedAt
      properties:
        id:
          type: string
          format: uuid
        name:
          type: string
        status:
          type: string
        priority:
          type: string
        dueDateKey:
          type: string
          format: date
        updatedAt:
          type: string
          format: date-time
    AIProjectLinkDecision:
      type: object
      required:
        - entityType
        - entityId
      properties:
        entityType:
          type: string
          enum:
            - note
            - library_item
            - feedback
        entityId:
          type: string
          format: uuid
    AIProjectLinkCandidate:
      allOf:
        - $ref: "#/components/schemas/AIProjectLinkDecision"
        - type: object
          required:
            - title
          properties:
            title:
              type: string
            subtitle:
              type: string
    AIProjectRiskFinding:
      type: object
      required:
        - risk
        - evidenceIds
        - revision
        - sourceVersion
      properties:
        risk:
          type: string
          enum:
            - on_track
            - needs_attention
            - blocked
        evidenceIds:
          type: array
          maxItems: 20
          items:
            type: string
            format: uuid
        revision:
          type: integer
          format: int64
          minimum: 1
        dismissedAt:
          type: string
          format: date-time
        sourceVersion:
          type: integer
          format: int64
          minimum: 1
    AIProjectContext:
      type: object
      description: Task and link candidates share a combined maximum of 47 entries;
        three additional questions are reserved for risk classification.
      required:
        - project
        - taskCandidates
        - linkCandidates
        - openTaskCount
        - overdueTaskCount
        - sourceFingerprint
      properties:
        project:
          $ref: "#/components/schemas/ProjectsProject"
        taskCandidates:
          type: array
          maxItems: 40
          items:
            $ref: "#/components/schemas/AIProjectTaskCandidate"
        linkCandidates:
          type: array
          maxItems: 47
          items:
            $ref: "#/components/schemas/AIProjectLinkCandidate"
        riskFinding:
          $ref: "#/components/schemas/AIProjectRiskFinding"
        openTaskCount:
          type: integer
          minimum: 0
        overdueTaskCount:
          type: integer
          minimum: 0
        sourceFingerprint:
          type: string
          minLength: 1
    AIProjectContextResponse:
      type: object
      required:
        - data
      properties:
        data:
          $ref: "#/components/schemas/AIProjectContext"
        request_id:
          type: string
          format: uuid
    ProjectsProject:
      type: object
      properties:
        id:
          type: string
          example: 11111111-1111-4111-8111-111111111111
        studioId:
          type: string
          example: 11111111-1111-4111-8111-111111111111
        name:
          type: string
          example: Example
        description:
          type: string
          example: Example content
        deadline:
          type: string
          format: date-time
          example: 2026-01-01T12:00:00Z
        deadlineKey:
          type: string
          example: example
        color:
          type: string
          example: "#3B82F6"
        priority:
          type: string
          example: medium
        createdBy:
          type: string
          example: example
        isPinned:
          type: boolean
          example: false
        isDefault:
          type: boolean
          example: false
        taskCount:
          type: integer
          format: int32
          example: 1
        completedTaskCount:
          type: integer
          format: int32
          example: 0
        inProgressTaskCount:
          type: integer
          format: int32
          example: 0
        todoTaskCount:
          type: integer
          format: int32
          example: 0
        activity7d:
          type: array
          description: >
            Daily project_events counts for the last 7 local days (index 0 =
            oldest, index 6 = today). Always length 7; missing days are 0.
          minItems: 7
          maxItems: 7
          items:
            type: integer
            format: int32
          example:
            - 0
            - 1
            - 0
            - 2
            - 0
            - 0
            - 3
        assigneeIds:
          type: array
          description: Up to 3 distinct recent task assignee user IDs for avatar stacks.
          maxItems: 3
          items:
            type: string
          example:
            - 11111111-1111-4111-8111-111111111111
        archivedAt:
          type: string
          format: date-time
          example: 2026-01-01T12:00:00Z
        createdAt:
          type: string
          format: date-time
          example: 2026-01-01T12:00:00Z
        updatedAt:
          type: string
          format: date-time
          example: 2026-01-01T12:00:00Z
      required:
        - id
        - studioId
        - name
        - priority
        - createdBy
        - isPinned
        - isDefault
        - taskCount
        - completedTaskCount
        - inProgressTaskCount
        - todoTaskCount
        - activity7d
        - assigneeIds
        - createdAt
        - updatedAt
    ErrorDetail:
      type: object
      required:
        - message
      properties:
        code:
          type: string
          example: VALIDATION_ERROR
        message:
          type: string
          example: The request is not valid.
        limit_key:
          type: string
        limit:
          type: integer
        required_plan:
          type: string
          enum:
            - pro
            - business
        resolution:
          type: string
          enum:
            - upgrade_plan
            - purchase_addon
        addon_key:
          type: string
          enum:
            - extra_members
            - ai_credit_packs
    ErrorResponse:
      type: object
      required:
        - error
      properties:
        error:
          $ref: "#/components/schemas/ErrorDetail"
        request_id:
          type: string
          format: uuid
  responses:
    BadRequest:
      description: Invalid request.
      content:
        application/json:
          schema:
            $ref: "#/components/schemas/ErrorResponse"
    Unauthorized:
      description: Missing or invalid authentication.
      content:
        application/json:
          schema:
            $ref: "#/components/schemas/ErrorResponse"
    Forbidden:
      description: Acceso denegado.
      content:
        application/json:
          schema:
            $ref: "#/components/schemas/ErrorResponse"
    NotFound:
      description: Recurso no encontrado.
      content:
        application/json:
          schema:
            $ref: "#/components/schemas/ErrorResponse"
    ServerError:
      description: Internal server error.
      content:
        application/json:
          schema:
            $ref: "#/components/schemas/ErrorResponse"
````
