Skip to content

discussion-vote-counter

by official

Discussion

Count votes and determine consensus status

discussion utility orchestrated-discussions
# discussion-vote-counter

Count votes and determine consensus status

## Installation

This is a CmdForge tool. Ensure you have CmdForge installed and this tool is available in your local registry.

## Usage

The tool accepts vote data via stdin and determines whether consensus has been reached based on configurable thresholds.

```bash
# Basic usage with default settings
echo '{"votes": [{"status": "READY"}, {"status": "READY"}, {"status": "NEEDS_WORK"}]}' | discussion-vote-counter

# Custom ready threshold (80% needed)
echo '{"votes": [...]}' | discussion-vote-counter --threshold-ready 0.80

# Disable human approval requirement
echo '{"votes": [...]}' | discussion-vote-counter --human-required false

# Require minimum of 3 votes
echo '{"votes": [...]}' | discussion-vote-counter --minimum-votes 3
```

## Arguments

| Flag | Default | Description |
|------|---------|-------------|
| `--threshold-ready` | `0.67` | Fraction of READY votes needed for consensus |
| `--threshold-reject` | `0.01` | Fraction of REJECT votes that blocks |
| `--human-required` | `true` | Whether human approval is required |
| `--minimum-votes` | `1` | Minimum number of votes needed |

## How It Works

The tool executes a single code step that:

1. Parses vote data from stdin
2. Calculates vote distribution (READY, NEEDS_WORK, REJECT)
3. Applies threshold rules to determine consensus status
4. Checks for human approval if required
5. Returns the consensus result with vote counts and status

The consensus logic ensures that:
- A minimum number of votes must be cast
- READY votes must meet or exceed the ready threshold
- Any REJECT votes above the reject threshold will block consensus
- Human approval can be enforced when `--human-required` is true

## Dependencies

None

No reviews yet.

Issues

No issues reported for this tool.