Skip to content

feat(reflector): bootstrap pass-based organization discovery audit engine - #7

Merged
szmyty merged 2 commits into
mainfrom
copilot/feat-reflector-bootstrap-organization-analysis-eng
Jun 26, 2026
Merged

feat(reflector): bootstrap pass-based organization discovery audit engine#7
szmyty merged 2 commits into
mainfrom
copilot/feat-reflector-bootstrap-organization-analysis-eng

Conversation

Copilot AI commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

This PR introduces the first Reflector foundation for organization-wide analysis: a compiler-style, pass-based audit engine driven by reusable policy and specification inputs. Scope is intentionally limited to read-only organization discovery and structured artifact generation for downstream passes.

  • Engine bootstrap

    • Added reflector/engines/audit/engine.py as the audit entrypoint.
    • Loads organization.spec, resolves enabled policy, executes discovery pass(es), and writes timestamped artifacts under .github/audits/<UTC_TIMESTAMP>/.
    • Emits both organization-level outputs (organization.audit.md/json) and per-repository outputs (repositories/<repo>.audit.md/json).
  • Pass architecture: 00_discovery

    • Added reflector/passes/00_discovery/discovery.py as a standalone read-only discovery pass.
    • Collects repository metadata, structure, documentation files, project manifests, and available GitHub metadata.
    • Produces repository audit content with the required fields: purpose, detected technologies, documentation quality, primary concepts, architectural observations, notable strengths, and notable questions.
  • Policy system

    • Added reusable policy definition at reflector/policies/documentation.policy.json.
    • Encodes analysis goals, repo selection filters, optimization priorities, and output behavior.
    • Keeps engine behavior policy-driven rather than hardcoded.
  • Organization source of truth

    • Added initial reflector/specs/organization.spec for organization metadata, repository inventory, audit configuration, enabled policies, and extension points for future passes/policy overrides.
  • Initial generated artifacts

    • Added first timestamped output set in .github/audits/2026-06-26T024532Z/ to establish artifact format and directory contract.
python reflector/engines/audit/engine.py
# => .github/audits/<UTC_TIMESTAMP>/
#    organization.audit.md
#    organization.audit.json
#    repositories/<repo>.audit.md
#    repositories/<repo>.audit.json

Copilot AI changed the title [WIP] Add initial version of organization analysis engine feat(reflector): bootstrap pass-based organization discovery audit engine Jun 26, 2026
Copilot AI requested a review from szmyty June 26, 2026 02:47
@szmyty
szmyty marked this pull request as ready for review June 26, 2026 04:37
@szmyty
szmyty requested a review from Copilot June 26, 2026 04:37
@szmyty
szmyty merged commit feeb0be into main Jun 26, 2026
1 check passed
@szmyty
szmyty deleted the copilot/feat-reflector-bootstrap-organization-analysis-eng branch June 26, 2026 04:40
@devactivity-app

Copy link
Copy Markdown

Pull Request Summary by devActivity

Metrics

Cycle Time: 1h 56m Coding Time: < 1 min Pickup Time: 1m Review Time: 1m

Achievements

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR bootstraps a new “Reflector” audit subsystem that can run a discovery pass over an organization’s repository inventory and emit structured, timestamped audit artifacts under .github/audits/<UTC_TIMESTAMP>/.

Changes:

  • Added a minimal audit engine entrypoint (reflector/engines/audit/engine.py) that loads an organization spec + policy, runs discovery, and writes org/repo audit artifacts.
  • Added the initial discovery pass (reflector/passes/00_discovery/discovery.py) to collect repo structure, docs/manifests, and GitHub metadata, with MD/JSON renderers.
  • Added policy/spec scaffolding plus a first committed sample output set under .github/audits/2026-06-26T024532Z/.

Reviewed changes

Copilot reviewed 9 out of 10 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
reflector/specs/organization.spec Defines organization metadata, repository inventory, enabled policies, and audit engine configuration.
reflector/README.md Documents the Reflector layout and how to run the audit engine.
reflector/policies/documentation.policy.json Introduces a reusable policy describing discovery goals and output configuration.
reflector/passes/00_discovery/discovery.py Implements the read-only discovery pass and MD/JSON reporting for per-repo audits.
reflector/engines/audit/engine.py Provides the audit engine bootstrap that loads spec/policy, runs the pass, and writes artifacts.
.gitignore Adds basic Python bytecode/cache ignores.
.github/audits/2026-06-26T024532Z/repositories/.github.audit.md Sample generated per-repository Markdown artifact.
.github/audits/2026-06-26T024532Z/repositories/.github.audit.json Sample generated per-repository JSON artifact.
.github/audits/2026-06-26T024532Z/organization.audit.md Sample generated organization-level Markdown artifact.
.github/audits/2026-06-26T024532Z/organization.audit.json Sample generated organization-level JSON artifact.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +95 to +105
repo_name = repository["name"]
repo_path = (root_dir / repository["path"]).resolve()

if not repo_path.exists():
return {
"name": repo_name,
"path": repository["path"],
"purpose": repository.get("purpose", ""),
"exists": False,
"error": "Repository path does not exist",
}
Comment on lines +26 to +33
def _find_files(repo_path: Path) -> list[Path]:
files: list[Path] = []
for path in repo_path.rglob("*"):
if ".git" in path.parts:
continue
if path.is_file():
files.append(path)
return files
Comment on lines +55 to +60
root_dir = Path.cwd()
spec = _load_json(spec_path)
policy_name = spec["enabled_policies"][0]
policy_path = root_dir / "reflector" / "policies" / f"{policy_name}.policy.json"
policy = _load_json(policy_path)

Comment on lines +69 to +79
discovery = _load_discovery_module(root_dir)

repository_audits: list[dict[str, Any]] = []
for repository in spec.get("repositories", []):
audit = discovery.run(repository, root_dir)
repository_audits.append(audit)

safe_name = audit.get("safe_name", audit["name"]) or "repository"
_write(repositories_dir / f"{safe_name}.audit.md", discovery.markdown_report(audit))
_write(repositories_dir / f"{safe_name}.audit.json", discovery.json_report(audit))

Comment on lines +95 to +96
_write(output_root / "organization.audit.json", json.dumps(organization_payload, indent=2, sort_keys=True) + "\n")
_write(output_root / "organization.audit.md", _organization_markdown(organization_payload))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants