> ## Documentation Index
> Fetch the complete documentation index at: https://cognitio-agent.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Create worktree

> Create a new git worktree for the current project and run any configured startup scripts.



## OpenAPI

````yaml /openapi.json post /experimental/worktree
openapi: 3.1.1
info:
  title: cognitio
  description: cognitio api
  version: 1.0.0
servers: []
security: []
paths:
  /experimental/worktree:
    post:
      summary: Create worktree
      description: >-
        Create a new git worktree for the current project and run any configured
        startup scripts.
      operationId: worktree.create
      parameters:
        - in: query
          name: directory
          schema:
            type: string
        - in: query
          name: workspace
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/WorktreeCreateInput'
      responses:
        '200':
          description: Worktree created
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Worktree'
        '400':
          description: Bad request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BadRequestError'
      x-codeSamples:
        - lang: js
          source: |-
            import { createCognitioClient } from "@cognitio/sdk

            const client = createCognitioClient()
            await client.worktree.create({
              ...
            })
components:
  schemas:
    WorktreeCreateInput:
      type: object
      properties:
        name:
          type: string
        startCommand:
          description: Additional startup script to run after the project's start command
          type: string
    Worktree:
      type: object
      properties:
        name:
          type: string
        branch:
          type: string
        directory:
          type: string
      required:
        - name
        - branch
        - directory
    BadRequestError:
      type: object
      properties:
        data: {}
        errors:
          type: array
          items:
            type: object
            propertyNames:
              type: string
            additionalProperties: {}
        success:
          type: boolean
          const: false
      required:
        - data
        - errors
        - success

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.