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

# Auto-Close Duplicates

> Automatically close confirmed duplicate issues after a grace period

# Auto-Close Duplicates

The auto-close feature automatically closes issues labelled `potential-duplicate` after a configurable grace period, while respecting human override signals.

## How it works

1. When Simili Bot detects a duplicate issue, it applies the `potential-duplicate` label and posts an analysis comment
2. A grace period begins (default: 72 hours)
3. At the end of the grace period, `simili auto-close` checks for human activity
4. If no human override signals are present, the issue is closed with a comment

## Human activity detection

The auto-closer **will not close** an issue if any of the following occur after the `potential-duplicate` label was applied:

| Signal            | Description                                              |
| ----------------- | -------------------------------------------------------- |
| Negative reaction | A non-bot user reacts with 👎 or 😕 on the bot's comment |
| Issue reopened    | A human reopens the issue after it was labelled          |
| Non-bot comment   | A non-bot user comments on the issue                     |

Bot users (accounts ending in `[bot]`, `dependabot`, `renovate`, and any accounts in `bot_users` config) are ignored for human activity detection.

## Setup

### 1. Configure grace period

In `.github/simili.yaml`:

```yaml theme={null}
auto_close:
  grace_period_hours: 72   # 3 days (default)
  dry_run: false
```

### 2. Create a scheduled workflow

Create `.github/workflows/simili-auto-close.yml`:

```yaml theme={null}
name: Simili Auto-Close Duplicates

on:
  schedule:
    - cron: '0 */6 * * *'  # Every 6 hours
  workflow_dispatch:         # Allow manual runs

jobs:
  auto-close:
    runs-on: ubuntu-latest
    permissions:
      issues: write
      contents: read
    steps:
      - uses: actions/checkout@v4

      - uses: similigh/simili-bot@v0.2.0
        with:
          command: "auto-close"
          config_path: ".github/simili.yaml"
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
          QDRANT_URL: ${{ secrets.QDRANT_URL }}
          QDRANT_API_KEY: ${{ secrets.QDRANT_API_KEY }}
          GEMINI_API_KEY: ${{ secrets.GEMINI_API_KEY }}
```

## Dry-run mode

Test auto-close without making any changes:

```bash theme={null}
simili auto-close --repo owner/repo --dry-run
```

Or with an instant grace period for testing:

```bash theme={null}
simili auto-close --repo owner/repo --grace-period-minutes 0 --dry-run
```

## Output

The command outputs a JSON summary:

```json theme={null}
{
  "processed": 12,
  "closed": 3,
  "skipped_grace_period": 7,
  "skipped_human_activity": 2,
  "errors": 0,
  "details": [
    {
      "number": 45,
      "action": "closed",
      "reason": "grace period expired, no human activity"
    },
    {
      "number": 52,
      "action": "skipped",
      "reason": "human_activity: non-bot comment detected"
    },
    {
      "number": 67,
      "action": "skipped",
      "reason": "grace_period: 12h remaining"
    }
  ]
}
```

## Tips

* **Set an appropriate grace period** — 72 hours gives authors time to respond. For fast-moving repos, consider 24-48 hours.
* **Use `workflow_dispatch`** in your workflow so you can trigger it manually when needed.
* **Run in dry-run first** to see which issues would be closed before enabling for real.
* **Combine with issue notifications** — users who open duplicates will see the bot comment and can react to prevent closure.

## Next steps

<CardGroup cols={2}>
  <Card title="Auto-close CLI reference" href="/reference/cli/auto-close-command">
    Full command options
  </Card>

  <Card title="Duplicate detection guide" href="/guides/duplicate-detection">
    How duplicates are detected
  </Card>
</CardGroup>
