Skip to content

Commit b8ff3fd

Browse files
committed
Add profile-based APCP context workflows
1 parent 61832ef commit b8ff3fd

20 files changed

Lines changed: 904 additions & 225 deletions

.github/repository-metadata.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# Apply these values in GitHub repository settings or with the GitHub CLI.
33

44
name: Nexus-APCP
5-
description: "AI Project Context Protocol for context engineering, AI-assisted development, local code intelligence, AI tool compatibility, agent skills, ADRs, and token optimization."
5+
description: "AI Project Context Protocol for profile-based context engineering, AI-assisted development, local code intelligence, AI tool compatibility, agent skills, ADRs, and token optimization."
66
homepage: "https://github.com/AybarsBarut/Nexus-APCP"
77
social_preview: "assets/nexus-apcp-social-preview.svg"
88
topics:

.github/workflows/validate.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,10 @@ jobs:
2828
run: python -m pip install --upgrade pip PyYAML
2929

3030
- name: Check Python syntax
31-
run: python -m py_compile scripts/apcp_core_files.py scripts/apcp-gather.py scripts/validate-repo.py
31+
run: python -m py_compile scripts/apcp_core_files.py scripts/apcp-gather.py scripts/apcp-install.py scripts/validate-repo.py
32+
33+
- name: Run unit tests
34+
run: python -m unittest discover -s tests
3235

3336
- name: Check PowerShell syntax
3437
shell: pwsh

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ PROMPT_READY.txt
1717
PROMPT_READY.tmp
1818
PROMPT_READY*.txt
1919
PROMPT_READY*.tmp
20+
apcp-profile.json
21+
.apcp-profile.json
2022
.checkpoint
2123
.apcp-cache/
2224
.codegraph/

AGENTS.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@ The public repository should remain safe to share. Real project context files, p
2626
| `CODEGRAPH_INTEGRATION_PROTOCOL.md` | Optional local CodeGraph-compatible code knowledge graph workflow and generated-index hygiene. |
2727
| `FILE_STRUCTURE_REFACTOR_PROTOCOL.md` | Safe iterative file and folder restructuring protocol for existing projects. |
2828
| `DEBLOAT_APPLICATION_GUIDE.md` | Lean application guidance for reducing ads, hidden tracking, heavy dependencies, optional feature load, and resource usage. |
29+
| `DISCOVER_ALGORITHM_DESIGN_GUIDE.md` | Optional problem-discovery and algorithm design guide for projects that need deeper exploration. |
30+
| `FRONTEND_APPLICATION_DESIGN_PROTOCOL.md` | Optional frontend application design protocol for UI-heavy projects. |
31+
| `UNIVERSAL_APPLICATION_SECURITY_PROTOCOL.md` | Optional baseline application security protocol for API, web, AI, and service projects. |
2932
| `AI_ASSISTANT_PROMPT_TEMPLATES.md` | Reusable prompts for common AI-assisted development scenarios. |
3033
| `WORKSPACE_SPECIFIC_DELIVERY_PROTOCOLS.md` | Domain-specific delivery gates and release expectations. |
3134
| `DOMAIN_SPECIFIC_GITIGNORE_PROTOCOLS.md` | Safe publishing patterns for different project domains. |
@@ -34,6 +37,7 @@ The public repository should remain safe to share. Real project context files, p
3437
| `CHANGELOG.md` | Release history and SemVer notes for public protocol-kit versions. |
3538
| `scripts/apcp_core_files.py` | Canonical core and install file lists used by scripts and validation. |
3639
| `scripts/apcp-gather.py` | Generates an AI-ready context bundle from core protocol files. |
40+
| `scripts/apcp-install.py` | Profile-aware installer for copying selected Nexus-APCP files into downstream projects. |
3741
| `scripts/validate-repo.py` | Repository integrity, metadata, and link validation script. |
3842
| `scripts/install-local-excludes.sh` / `scripts/install-local-excludes.ps1` | Local Git exclude installers for downstream repositories. |
3943
| `docs/SEO_CHECKLIST.md` | Repository SEO metadata and keyword source of truth. |
@@ -44,7 +48,8 @@ Run these from the repository root.
4448

4549
```bash
4650
python scripts/apcp-gather.py --caveman
47-
python -m py_compile scripts/apcp_core_files.py scripts/apcp-gather.py scripts/validate-repo.py
51+
python -m py_compile scripts/apcp_core_files.py scripts/apcp-gather.py scripts/apcp-install.py scripts/validate-repo.py
52+
python -m unittest discover -s tests
4853
python scripts/validate-repo.py
4954
```
5055

AI_MAIN.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ This file is a copy-safe starter template. After copying Nexus-APCP into a proje
99

1010
## SYSTEM_INIT
1111
- **Protocol**: CAVEMAN optional. Activate only when requested or when `PROMPT_READY.txt` says `Mode: CAVEMAN`.
12+
- **Context Profile**: load `apcp-profile.json` when present. If absent, assume `core` and activate specialized protocols only when task-relevant.
1213
- **Quality**: production-ready, verified, no simulated work.
1314
- **Safety**: DRY, SOLID, secure, public/private boundary respected.
1415
- **Checkpoints**: mandatory validation at each gate.
@@ -65,8 +66,21 @@ This file is a copy-safe starter template. After copying Nexus-APCP into a proje
6566
- Preserve the public/private boundary from `AI_PROJECT_CONTEXT_PROTOCOL.md` and `DOMAIN_SPECIFIC_GITIGNORE_PROTOCOLS.md`.
6667
- Keep generated prompt bundles such as `PROMPT_READY.txt` out of public commits.
6768
- Prefer current project evidence over copied template state.
69+
- Treat selected profile files as active context. Treat non-selected specialized protocols as references, not standing instructions, unless the user or task explicitly invokes them.
6870
- If context is stale or contradictory, stop and reconcile before implementation.
6971

72+
## RULE_PRIORITY
73+
74+
When rules conflict, use this order:
75+
76+
1. Current user request and explicit approvals.
77+
2. Security, privacy, secret-handling, and public/private boundary rules.
78+
3. Project-specific filled context and current task state.
79+
4. Selected APCP profile files and task-invoked specialized protocols.
80+
5. General examples, templates, and optional reference protocols.
81+
82+
If two active rules still conflict, choose the narrower task-specific rule, explain the conflict briefly, and ask only when proceeding would create real risk.
83+
7084
---
7185

7286
*Nexus-APCP: logic first, tokens last.*

AI_PROJECT_CONTEXT_PROTOCOL.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,19 @@ This file is the **single source of truth** for AI coding assistants and agents
1111
- Changes are synchronized automatically
1212
- The AI takes on the role of project manager
1313

14+
### Active Context Profile
15+
16+
Nexus-APCP supports profile-based context loading through `apcp-profile.json`.
17+
Use `core` unless the project clearly needs `web`, `backend-api`, `cli`, `game`, `ai-rag`, or `full`.
18+
Specialized protocols outside the active profile are references, not standing instructions, unless the current user request or task explicitly invokes them.
19+
20+
Rule priority:
21+
1. Current user request and explicit approvals.
22+
2. Security, privacy, secret-handling, and public/private boundary rules.
23+
3. Filled project context and current task state.
24+
4. Selected APCP profile files and task-invoked specialized protocols.
25+
5. General examples, templates, and optional reference protocols.
26+
1427
---
1528

1629
## SECTION 1: GENERAL PROJECT INFORMATION

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ Nexus-APCP follows SemVer for public protocol-kit releases. A version in `codeme
77
## [Unreleased]
88

99
- Centralize the canonical APCP core file list for gather, validation, and documentation consistency.
10+
- Add profile-based install and context gathering with `apcp-profile.json`, `scripts/apcp-install.py`, and default narrow `core` context.
11+
- Add unit tests for profile selection, gather error handling, config filtering, and installer dry-run behavior.
1012
- Harden repository validation with syntax checks, YAML parsing, generated artifact cleanup, Markdown anchor checks, and simple leak-pattern scanning.
1113
- Add safer local-exclude and checkpoint workflows for downstream public repository hygiene.
1214
- Add optional CodeGraph-compatible local code knowledge graph guidance for semantic discovery, call tracing, impact analysis, and generated index hygiene.

CONTEXT_OPTIMIZATION.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,13 @@ As a software project grows, the codebase and documentation eventually exceed th
55

66
## Modular Context Strategy
77

8+
### Profile Filter
9+
**Usage**: Before packaging context for a project.
10+
- **Default**: `core`, loaded from `apcp-profile.json` when present.
11+
- **Project profiles**: `web`, `backend-api`, `cli`, `game`, `ai-rag`, and `full`.
12+
- **Rule**: Use the narrowest profile that matches the project. Add files through `include` only when the current task needs them, and remove unrelated files through `exclude`.
13+
- **Token Impact**: prevents specialized protocols from entering the model context when they do not match the project.
14+
815
### Level 1: Standard (Bootstrap Mode)
916
**Usage**: When starting a new session or a new project.
1017
- **Files**: Full `AI_PROJECT_CONTEXT_PROTOCOL.md` + Full `TASK_PROGRESS.yaml`.

0 commit comments

Comments
 (0)