> ## Documentation Index
> Fetch the complete documentation index at: https://docs.sudocode.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# sudocode issue close

> Close one or more completed issues

# sudocode issue close

Close one or more issues to mark them as complete.

## Syntax

```bash theme={null}
sudocode issue close <issue-id> [<issue-id>...] [options]
```

## Description

The `issue close` command marks issues as completed by setting their status to `closed` and recording the closure timestamp. This is the standard way to complete work in sudocode.

When you close an issue:

* Status is set to `closed`
* `closed_at` timestamp is recorded
* `updated_at` timestamp is updated
* Changes are exported to JSONL for version control
* The issue remains in the database (not deleted)

<Note>
  Closing is a soft operation - issues remain in the database and can be reopened if needed. This is different from deleting, which permanently removes the issue.
</Note>

## Arguments

<ParamField path="issue-id" type="string" required>
  One or more issue IDs to close

  **Example:** `ISSUE-001` or `ISSUE-001 ISSUE-002 ISSUE-003`

  You can close multiple issues in a single command by providing multiple IDs.
</ParamField>

## Options

<ParamField path="-r, --reason" type="string">
  Closure reason or comment

  **Example:** `--reason "Feature completed and tested"`

  This is currently accepted but not stored in the database. Use for logging purposes in scripts.
</ParamField>

## Examples

### Close a Single Issue

Mark one issue as complete:

```bash theme={null}
sudocode issue close ISSUE-001
```

<Accordion title="Expected output">
  ```
  ✓ Closed issue ISSUE-001
  ```
</Accordion>

### Close Multiple Issues

Mark several issues as complete at once:

```bash theme={null}
sudocode issue close ISSUE-001 ISSUE-002 ISSUE-003
```

<Accordion title="Expected output">
  ```
  ✓ Closed issue ISSUE-001
  ✓ Closed issue ISSUE-002
  ✓ Closed issue ISSUE-003
  ```
</Accordion>

### Close with Reason

Provide a closure reason (for logging):

```bash theme={null}
sudocode issue close ISSUE-001 --reason "Feature completed and tested"
```

<Accordion title="Expected output">
  ```
  ✓ Closed issue ISSUE-001
  ```
</Accordion>

<Info>
  The `--reason` option is accepted but not currently stored. It's useful for command history and scripting logs.
</Info>

### Close Non-Existent Issue

Attempt to close an issue that doesn't exist:

```bash theme={null}
sudocode issue close ISSUE-999
```

<Accordion title="Expected output">
  ```
  ✗ Failed to close ISSUE-999 : Issue not found
  ```
</Accordion>

When closing multiple issues, valid closures proceed even if some IDs don't exist:

```bash theme={null}
sudocode issue close ISSUE-001 ISSUE-999 ISSUE-002
```

<Accordion title="Expected output">
  ```
  ✓ Closed issue ISSUE-001
  ✗ Failed to close ISSUE-999 : Issue not found
  ✓ Closed issue ISSUE-002
  ```
</Accordion>

### JSON Output

Get machine-readable output:

```bash theme={null}
sudocode --json issue close ISSUE-001 ISSUE-002
```

<Accordion title="JSON output">
  ```json theme={null}
  [
    {
      "id": "ISSUE-001",
      "success": true
    },
    {
      "id": "ISSUE-002",
      "success": true
    }
  ]
  ```
</Accordion>

## What Happens When You Close an Issue

<Steps>
  <Step title="Status updated">
    The issue's `status` field is set to `closed`
  </Step>

  <Step title="Timestamps updated">
    * `closed_at` is set to the current timestamp
    * `updated_at` is set to the current timestamp
  </Step>

  <Step title="Database updated">
    Changes are written to the SQLite database
  </Step>

  <Step title="JSONL exported">
    The closure is recorded in `issues.jsonl`
  </Step>

  <Step title="Blockers released">
    Any issues blocked by this issue can now proceed (if this was their only blocker)
  </Step>
</Steps>

## What Doesn't Change

<Info>
  The following remain unchanged when closing an issue:
</Info>

* **Issue ID** - Stays the same
* **Assignee** - Remains assigned
* **Priority** - Unchanged
* **Relationships** - All relationships persist
* **Content** - Issue description remains
* **Tags** - Tags are retained

Closed issues remain fully accessible and can be viewed, searched, and reopened.

## Common Workflows

### Completing Work

<Steps>
  <Step title="Finish implementation">
    Complete the feature and commit code
  </Step>

  <Step title="Run tests">
    Ensure all tests pass
  </Step>

  <Step title="Close the issue">
    ```bash theme={null}
    sudocode issue close ISSUE-001
    ```
  </Step>

  <Step title="Commit to git">
    ```bash theme={null}
    git add .sudocode/issues.jsonl
    git commit -m "Close ISSUE-001: OAuth implementation complete"
    ```
  </Step>
</Steps>

### Closing After Review

<Steps>
  <Step title="Mark as needs review">
    ```bash theme={null}
    sudocode issue update ISSUE-001 --status needs_review
    ```
  </Step>

  <Step title="Review code and approve">
    Team reviews the implementation
  </Step>

  <Step title="Close after approval">
    ```bash theme={null}
    sudocode issue close ISSUE-001
    ```
  </Step>
</Steps>

### Bulk Closing

Close multiple completed issues:

```bash theme={null}
# Close all issues marked as needs_review
sudocode --json issue list --status needs_review | jq -r '.[] | .id' | xargs sudocode issue close
```

```bash theme={null}
# Close all issues assigned to alice that are done
for issue_id in $(sudocode --json issue list --assignee "alice" | jq -r '.[] | select(.status == "needs_review") | .id'); do
  sudocode issue close "$issue_id"
done
```

### Reopening a Closed Issue

If work needs to resume:

```bash theme={null}
# Reopen by setting status back to open
sudocode issue update ISSUE-001 --status open
```

<Info>
  Reopening clears the `closed_at` timestamp and allows work to continue.
</Info>

## Close vs Delete vs Archive

<CardGroup cols={3}>
  <Card title="Close" icon="circle-check">
    **Normal completion**

    * Standard workflow completion
    * Issue remains visible in closed state
    * Can be reopened if needed
    * Preserves all data and relationships
  </Card>

  <Card title="Delete" icon="trash">
    **Permanent removal**

    * Removes issue from database
    * Deletes from JSONL
    * Cannot be undone (except via git)
    * Use for mistakes or duplicates
  </Card>

  <Card title="Archive" icon="box-archive">
    **Hide from view**

    * Hides from default listings
    * Preserves all data
    * For abandoned or obsolete work
    * Can be unarchived later
  </Card>
</CardGroup>

**When to use each:**

* **Close:** Normal workflow - feature complete, bug fixed, work done
* **Archive:** Work abandoned or no longer relevant, but want historical record
* **Delete:** Duplicate issues, test issues, genuinely wrong content

## Finding Closed Issues

View closed issues:

```bash theme={null}
# List all closed issues
sudocode issue list --status closed

# Search closed issues
sudocode issue list --status closed --grep "oauth"

# View a specific closed issue
sudocode issue show ISSUE-001
```

## Common Questions

<AccordionGroup>
  <Accordion title="Can I close an issue that's not assigned to me?">
    Yes, any user can close any issue. There are no access controls in the CLI.
  </Accordion>

  <Accordion title="What happens to issues blocked by a closed issue?">
    They become unblocked and can proceed. Check ready work:

    ```bash theme={null}
    sudocode ready
    ```
  </Accordion>

  <Accordion title="Can I close an issue without assigning it first?">
    Yes, assignee is optional. You can close unassigned issues:

    ```bash theme={null}
    sudocode issue close ISSUE-001
    ```
  </Accordion>

  <Accordion title="How do I reopen a closed issue?">
    Update the status back to `open`:

    ```bash theme={null}
    sudocode issue update ISSUE-001 --status open
    ```

    This clears the `closed_at` timestamp.
  </Accordion>

  <Accordion title="Is there a confirmation prompt before closing?">
    No, `issue close` executes immediately. For safety in scripts, add your own confirmation:

    ```bash theme={null}
    read -p "Close issue? (y/n) " -n 1 -r
    [[ $REPLY =~ ^[Yy]$ ]] && sudocode issue close ISSUE-001
    ```
  </Accordion>

  <Accordion title="Can I see who closed an issue?">
    Not directly from the CLI. The `updated_at` timestamp shows when it was closed, but not who closed it. Use git history to track this:

    ```bash theme={null}
    git log -p .sudocode/issues.jsonl | grep ISSUE-001
    ```
  </Accordion>

  <Accordion title="Will closing notify anyone?">
    No, sudocode doesn't have built-in notifications. Closures are tracked via git commits.
  </Accordion>
</AccordionGroup>

## Troubleshooting

<AccordionGroup>
  <Accordion title="Error: Issue not found">
    **Cause:** The issue ID doesn't exist

    **Solution:**
    Verify the ID:

    ```bash theme={null}
    sudocode issue list
    ```
  </Accordion>

  <Accordion title="Issue still appears as open after closing">
    **Cause:** Cache or sync issue

    **Solution:**
    Run sync to ensure consistency:

    ```bash theme={null}
    sudocode sync
    ```

    Verify the closure:

    ```bash theme={null}
    sudocode issue show ISSUE-001
    ```
  </Accordion>

  <Accordion title="Closed issue doesn't appear in closed list">
    **Cause:** May still be filtered out

    **Solution:**
    Try:

    ```bash theme={null}
    sudocode issue list --status closed --limit 100
    ```
  </Accordion>

  <Accordion title="Can't close issue - database locked">
    **Cause:** Another process is accessing the database

    **Solution:**

    1. Close other sudocode processes
    2. Wait a moment and retry
    3. Check for zombie processes: `ps aux | grep sudocode`
  </Accordion>
</AccordionGroup>

## Related Commands

<CardGroup cols={3}>
  <Card title="issue list" icon="list" href="/cli/issue-list">
    List all issues
  </Card>

  <Card title="issue show" icon="eye" href="/cli/issue-show">
    View issue details
  </Card>

  <Card title="issue update" icon="pen-to-square" href="/cli/issue-update">
    Update issue (reopen)
  </Card>

  <Card title="issue delete" icon="trash" href="/cli/issue-delete">
    Delete an issue permanently
  </Card>

  <Card title="ready" icon="circle-check" href="/cli/ready">
    Find ready work
  </Card>

  <Card title="blocked" icon="ban" href="/cli/blocked">
    View blocked issues
  </Card>
</CardGroup>

## Next Steps

<Steps>
  <Step title="Complete your work">
    Implement the feature and test
  </Step>

  <Step title="Close the issue">
    ```bash theme={null}
    sudocode issue close ISSUE-001
    ```
  </Step>

  <Step title="Verify closure">
    ```bash theme={null}
    sudocode issue show ISSUE-001
    ```
  </Step>

  <Step title="Find next work">
    ```bash theme={null}
    sudocode ready
    ```
  </Step>
</Steps>

<Card title="Issues Concept Guide" icon="book" href="/concepts/issues">
  Learn more about issues and their lifecycle
</Card>
