@@ -67,16 +67,74 @@ across all AI-assisted development work.
6767
6868## ⚙️ How This Repository Works
6969
70+ ### Understanding the Framework Structure
71+
72+ This repository serves as both:
73+ 1 . ** A GitHub Template** : Use it to create new repositories with the framework
74+ 2 . ** A Working Framework** : Once created, it provides governance and quality enforcement
75+
7076### 1. Template Structure
7177
72- When you use this framework , you get:
78+ When you use this template , you get a complete framework with :
7379
7480| Component | Status | Description |
7581| -----------| --------| -------------|
7682| ✅ Governance Documentation | Included | Standards and requirements that AI agents must follow |
7783| ✅ Security Enforcement | Included | Strict ` .gitignore ` policies and pre-commit hooks |
7884| ✅ Quality Gates | Included | Automated formatting, linting, and safety checks |
7985| ✅ Consistent Standards | Included | Bash, Python, YAML, and JSON formatting rules |
86+ | ✅ CI/CD Pipeline | Included | Automated testing and quality checks on every PR |
87+ | ✅ Issue & PR Templates | Included | Structured templates for bug reports and features |
88+ | ✅ Helper Scripts | Included | Pre-commit wrapper and secret detection |
89+
90+ ### File Relationships and Workflow
91+
92+ ** Core Governance Files** :
93+
94+ ``` text
95+ docs/ai/CONTEXT.md (Authoritative)
96+ ↓
97+ ├─→ Defines AI agent behavior standards
98+ ├─→ Referenced by: README.md, scripts, CI
99+ └─→ Must be followed by all AI tools
100+
101+ docs/requirements.md (Project Contract)
102+ ↓
103+ ├─→ Defines project-specific requirements
104+ ├─→ Maps to acceptance criteria
105+ └─→ Updated before implementation
106+
107+ README.md (User Documentation)
108+ ↓
109+ ├─→ Human-readable project overview
110+ ├─→ References CONTEXT.md standards
111+ └─→ Provides usage examples
112+ ```
113+
114+ ** Quality Enforcement Chain** :
115+
116+ ``` text
117+ Developer/AI Agent
118+ ↓
119+ Makes changes
120+ ↓
121+ Runs: ./scripts/run-precommit.sh
122+ ↓
123+ Pre-commit hooks execute:
124+ ├─→ Formatting (Ruff, shfmt)
125+ ├─→ Linting (ShellCheck, PyMarkdown)
126+ ├─→ Secret detection (detect-secrets.sh)
127+ └─→ Safety checks (private keys, merge conflicts)
128+ ↓
129+ If passes → Commit succeeds
130+ If fails → Commit blocked, review artifacts/pre-commit.log
131+ ↓
132+ Push to GitHub
133+ ↓
134+ CI runs same checks (cannot be bypassed)
135+ ↓
136+ If CI passes → PR can be merged
137+ ```
80138
81139### 2. AI Agent Workflow
82140
@@ -167,8 +225,31 @@ Documentation in this repository serves as **executable instructions** for AI ag
167225| ` docs/ai/CONTEXT.md ` | Mandatory AI behavior standards | AI agents (authoritative) | ✅ Required |
168226| ` docs/requirements.md ` | Project requirements and acceptance criteria | AI agents, developers | ✅ Required |
169227| ` docs/ci-and-precommit.md ` | Quality enforcement mechanisms | Developers, operators | ✅ Required |
228+ | ` docs/governance/ ` | Project-specific governance documents | All stakeholders | ⚠️ Optional |
170229| ` README.md ` | Project overview and usage | All stakeholders | ✅ Required |
171230
231+ ** Documentation Hierarchy** :
232+
233+ 1 . ** ` docs/ai/CONTEXT.md ` ** is ** authoritative** for AI agents
234+ - Defines mandatory behavior standards
235+ - Referenced by all other documentation
236+ - Must be followed without exception
237+
238+ 2 . ** ` docs/requirements.md ` ** defines the project contract
239+ - Maps requirements to acceptance criteria
240+ - Must be updated before implementation
241+ - Guides AI agent development work
242+
243+ 3 . ** ` README.md ` ** provides human-readable guidance
244+ - Explains how to use the framework
245+ - Documents configuration and usage
246+ - References CONTEXT.md for AI agent instructions
247+
248+ 4 . ** ` docs/governance/ ` ** is for project-specific governance
249+ - Empty by default
250+ - Add custom governance documents as needed
251+ - Examples: coding standards, review processes, etc.
252+
172253#### Documentation Requirements
173254
174255Per ` docs/ai/CONTEXT.md ` , all projects must include:
@@ -210,12 +291,16 @@ Per `docs/ai/CONTEXT.md`, all projects must include:
210291
211292## 🏗️ High-Level Architecture Overview
212293
294+ <<<<<<< HEAD
213295<div style =" display : flex ; align-items : flex-start ; gap : 20px ; margin-bottom : 20px ;" >
214296 <div style =" flex : 0 0 25% ;" >
215297 <img src="https://chrispaquin.com/wp-content/uploads/2026/01/framework-flow.png"
216298 alt="Nobby the Robot" width="60%" align="center">
217299 </div >
218300
301+ =======
302+ <img src =" architecture-diagram.png " alt =" GitHub AI Engineering Framework Architecture " width =" 100% " >
303+ >>>>>>> c38cc50 (Enhance README with comprehensive template workflow documentation)
219304
220305** Key Components** :
221306
@@ -228,9 +313,34 @@ Per `docs/ai/CONTEXT.md`, all projects must include:
228313
229314## 🚀 Installation
230315
231- ### Step 1: Use This Framework
316+ ### How This Template Works
317+
318+ This is a ** GitHub Template Repository** . When you use it, GitHub creates a new
319+ repository with all the files from this template, giving you a complete
320+ framework for AI-assisted development with governance, security, and quality
321+ enforcement built-in.
232322
233- - [ ] Click ** "Use this template"** on GitHub to create a new repository from this framework
323+ ** Template Workflow** :
324+
325+ 1 . ** Create Repository** : Use GitHub's "Use this template" button
326+ 2 . ** Clone & Setup** : Clone your new repo and set up pre-commit
327+ 3 . ** Customize** : Populate project-specific files and documentation
328+ 4 . ** Start Developing** : Begin using the framework with AI agents
329+
330+ ### Step 1: Use This Template
331+
332+ - [ ] Click ** "Use this template"** on GitHub
333+ - [ ] Choose a repository name and description
334+ - [ ] Select public or private visibility
335+ - [ ] Click ** "Create repository from template"**
336+
337+ This creates a new repository with all framework files:
338+ - ✅ Directory structure (` docs/ ` , ` .github/ ` , ` scripts/ ` )
339+ - ✅ Configuration files (` .pre-commit-config.yaml ` , ` .gitignore ` , etc.)
340+ - ✅ Documentation templates (` CONTEXT.md ` , ` requirements.md ` )
341+ - ✅ CI/CD workflows (` .github/workflows/ci.yaml ` )
342+ - ✅ Helper scripts (` run-precommit.sh ` , ` detect-secrets.sh ` )
343+ - ✅ Issue and PR templates
234344
235345### Step 2: Clone Your New Repository
236346
@@ -250,22 +360,67 @@ pre-commit install
250360
251361- [ ] Pre-commit is installed
252362- [ ] Pre-commit hooks are installed
253- - [ ] Run ` pre-commit run --all-files ` to verify setup
363+ - [ ] Run ` ./scripts/ run-precommit.sh ` to verify setup
254364
255365### Step 4: Populate Project-Specific Files
256366
367+ ** Required Customization** :
368+
257369- [ ] ** ` docs/requirements.md ` ** : Define your project's requirements and acceptance criteria
370+ - Use the template structure provided
371+ - Document functional and non-functional requirements
372+ - Define acceptance criteria for each requirement
258373- [ ] ** ` .env.example ` ** : Create an example environment file documenting required variables
374+ - List all environment variables your project needs
375+ - Use placeholder values (e.g., ` YOUR_API_KEY_HERE ` )
376+ - Document what each variable is for
259377- [ ] ** ` README.md ` ** : Update with your project-specific information
378+ - Replace framework description with your project description
379+ - Update architecture diagram (if using image)
380+ - Customize installation and usage sections
381+
382+ ** Optional Customization** :
383+
384+ - [ ] ** ` docs/governance/ ` ** : Add project-specific governance documents
385+ - [ ] ** ` docs/runbook.md ` ** : Create operational runbook (if applicable)
386+ - [ ] ** Issue Templates** : Customize ` .github/ISSUE_TEMPLATE/ ` files if needed
387+ - [ ] ** PR Template** : Customize ` .github/pull_request_template.md ` if needed
260388
261389### Step 5: Bootstrap Structure (Optional)
262390
263- If you need to recreate the template structure:
391+ The ` bootstrap-template-structure.sh ` script recreates the template's directory
392+ structure and empty placeholder files. Use it if:
393+
394+ - You accidentally deleted framework files
395+ - You want to add the structure to an existing repository
396+ - You need to restore the template structure
397+
398+ ** What It Creates** :
399+
400+ ** Directories** :
401+ - ` docs/ ` , ` docs/ai/ ` , ` docs/governance/ `
402+ - ` .github/ ` , ` .github/workflows/ ` , ` .github/ISSUE_TEMPLATE/ `
403+ - ` scripts/ `
404+
405+ ** Files** (empty placeholders):
406+ - ` README.md ` , ` LICENSE ` , ` .gitignore `
407+ - ` .pre-commit-config.yaml ` , ` .pymarkdown.json `
408+ - ` docs/ai/CONTEXT.md ` , ` docs/requirements.md ` , ` docs/ci-and-precommit.md `
409+ - ` .github/workflows/ci.yaml `
410+ - ` .github/pull_request_template.md `
411+ - ` .github/ISSUE_TEMPLATE/feature_request.yml `
412+ - ` .github/ISSUE_TEMPLATE/bug_report.yml `
413+ - ` scripts/run-precommit.sh ` , ` scripts/detect-secrets.sh `
414+
415+ ** Usage** :
264416
265417``` bash
266418./bootstrap-template-structure.sh
267419```
268420
421+ ** Note** : The script will ** not overwrite** existing files—it only creates missing
422+ files and directories.
423+
269424---
270425
271426## 🗑️ Uninstall Steps
@@ -307,6 +462,45 @@ the requirements in docs/requirements.md. Ensure pre-commit passes
307462before completing the work.
308463```
309464
465+ ### Understanding the Artifacts Directory
466+
467+ The ` artifacts/ ` directory is automatically created and ignored by git. It
468+ contains:
469+
470+ - ** ` pre-commit.log ` ** : Detailed output from pre-commit runs
471+ - Created by ` scripts/run-precommit.sh `
472+ - Contains full hook output for debugging
473+ - Useful for AI agents to review failures
474+ - Uploaded as CI artifact on failure
475+
476+ ** Note** : The ` artifacts/ ` directory is in ` .gitignore ` and should never be
477+ committed.
478+
479+ ### Using Issue Templates
480+
481+ The framework includes structured issue templates:
482+
483+ ** Bug Reports** (` .github/ISSUE_TEMPLATE/bug_report.yml ` ):
484+ - Requires: Summary, reproduction steps, expected/actual behavior, environment
485+ - Automatically labels issues as "bug"
486+
487+ ** Feature Requests** (` .github/ISSUE_TEMPLATE/feature_request.yml ` ):
488+ - Requires: Problem statement, desired outcome, acceptance criteria
489+ - Automatically labels issues as "enhancement"
490+ - Encourages requirement documentation before implementation
491+
492+ ### Using the Pull Request Template
493+
494+ The PR template (` .github/pull_request_template.md ` ) ensures:
495+
496+ - ✅ Requirements coverage is documented
497+ - ✅ Acceptance criteria are verified
498+ - ✅ Security and safety checks are confirmed
499+ - ✅ Testing evidence is provided
500+ - ✅ Documentation is updated
501+
502+ This template enforces the discipline required by ` docs/ai/CONTEXT.md ` Section 10.
503+
310504### Running Pre-commit Checks
311505
312506** ✅ Recommended method** (for AI-assisted workflows):
@@ -384,11 +578,33 @@ If secrets are detected, the commit will be blocked. Use example placeholders li
384578
385579### CI/CD Configuration
386580
387- CI workflows are defined in ` .github/workflows/ci.yaml ` . The workflow:
581+ CI workflows are defined in ` .github/workflows/ci.yaml ` . The workflow consists
582+ of two jobs that run sequentially:
583+
584+ ** Job 1: Pre-commit Checks** (runs first):
585+
586+ - ✅ Runs on all pull requests and pushes to ` main `
587+ - ✅ Executes all pre-commit hooks (formatting, linting, secret detection)
588+ - ✅ Uses Python 3.11 on Ubuntu latest
589+ - ✅ If checks fail, generates detailed log via ` scripts/run-precommit.sh `
590+ - ✅ Uploads pre-commit log as artifact for review (only on failure)
591+
592+ ** Job 2: Unit Tests** (runs after pre-commit passes):
593+
594+ - ✅ Only runs if pre-commit job succeeds
595+ - ✅ Conditionally installs dependencies:
596+ - Installs from ` requirements.txt ` if present
597+ - Installs from ` requirements-dev.txt ` if present
598+ - Installs ` pytest ` only if ` tests/ ` directory exists
599+ - ✅ Runs ` pytest ` if tests exist, otherwise skips gracefully
600+ - ✅ Ensures code quality before running tests
601+
602+ ** Key Features** :
388603
389- - ✅ Runs pre-commit checks on all PRs and pushes
390- - ✅ Runs unit tests (if ` tests/ ` directory exists)
391- - ✅ Uploads pre-commit logs as artifacts on failure
604+ - 🔒 ** Cannot be bypassed** : All checks run in CI, preventing skipped local checks
605+ - 📋 ** Artifact logging** : Failed pre-commit runs generate downloadable logs
606+ - ⚡ ** Efficient** : Tests only run if pre-commit passes
607+ - 🔄 ** Consistent** : Same checks run locally and in CI
392608
393609### Markdown Configuration
394610
0 commit comments