Numsec is a CLI for automated threat modeling inside IDEs. It analyzes code, identifies issues using STRIDE, and provides AI assistants (Cursor, Windsurf, Trae) with structured context to help remediate them.
This repository contains the CLI itself and built-in project templates used by numsec init.
- Python 3.9+
- Git (recommended so
numsec initcan rungit init)
The simplest way is to install the package in editable mode:
- First, clone the repository:
git clone https://github.com/retampweb/numsec.git
cd numsec- Then, follow the installation steps:
python3 -m venv .venv
source .venv/bin/activate
pip install -e .- Verify the installation:
numsec --version
numsec --helpWould you like me to explain any of these steps in more detail (づ ᴗ _ᴗ)づ♡ ?
User in Cursor: "/numsec analyze" Cursor runs: numsec analyze --ai-format Result: numsec/threats/THREAT-001/threat.md with threat details
User: "/numsec fix THREAT-001" Claude reads threat.md and generates a fix into numsec/changes/FIX-THREAT-001/
User: "/numsec apply FIX-THREAT-001" The patch is applied to the codebase
- Write chat commands as:
/numsec "<command>" - The protocol and assistant expectations live in:
NUMSEC.md
If you use Windsurf/Cursor, projects created via numsec init also include:
.windsurf/workflows/numsec.md.cursor/rules/numsec.mdc
These files tell the assistant to read NUMSEC.md first, then numsec/project.md, and relevant numsec/threats/THREAT-*/threat.md.
numsec list-templatesCreates the project directory, copies files from the template, and runs git init.
numsec init my-projectSelect a template:
numsec init my-project --template basicIf the directory already exists:
numsec init my-project --forceAfter numsec init my-project the structure will look roughly like:
my-project/
NUMSEC.md
.gitignore
.cursor/
rules/
numsec.mdc
.windsurf/
workflows/
numsec.md
README.md
requirements.txt
src/
app/
__init__.py
main.py
numsec/
project.md
architecture.md
security-requirements.md
threats/
README.md
THREAT-001/
threat.md
cd my-project
python -m app.mainKey parts:
-
src/numsec/cli.py- CLI built on
click - MVP core commands:
init,list-templates,analyze
- CLI built on
-
src/numsec/templates/- template loader
- built-in templates live under
src/numsec/templates/templates/
-
pyproject.toml- defines packaging and console script entrypoint
numsec = numsec.cli:cli - includes templates in the distribution (package data)
- defines packaging and console script entrypoint
In this repository, the Numsec/ directory is used to track requirements/specs and changes.
Numsec/specs/<capability>/spec.md— requirements and scenarios for the current system
Numsec/changes/<change-id>/proposal.md— why/what changesNumsec/changes/<change-id>/tasks.md— implementation checklistNumsec/changes/<change-id>/specs/...— spec deltas
Recommended flow:
- Create a change (
Numsec/changes/<id>/...) - Review/approve the proposal
- Implement tasks from
tasks.md - Validate (
Numsec validate <id> --strict), then archive the change after release
- Ensure your virtual environment is activated (
source .venv/bin/activate) - Ensure the package is installed (
pip install -e .)
- This means templates were not included in the installation.
- Check that you installed the package from a repository that contains
src/numsec/templates/templates/.
Currently, the CLI skeleton and the minimal basic template are implemented. Commands like scan-deps, lint, and plugin install are placeholders and will be expanded in future changes.