Skip to content

Monorepo scaffold + Phase 0 schema for the Agent Context Attention Layer - #3

Merged
FScholPer merged 8 commits into
mainfrom
context-attention-phase0-schema
Jul 27, 2026
Merged

FScholPer merged 8 commits into
mainfrom
context-attention-phase0-schema

Conversation

@FScholPer

@FScholPer FScholPer commented Jul 23, 2026 •

Copy link
Copy Markdown
Contributor

Summary

First step of the Agent Context Attention Layer for Eclipse S-CORE. Turns this repo into an APM monorepo-hybrid and lands Phase 0 only: the schema / data model. No adapters, graph composition, ranking, apm.yml generation, or MCP server implementation yet — those are later phases; placeholders mark where they go.

(Supersedes #2, which auto-closed when the branch was renamed.)

The layer's job is to turn "trace everything" across S-CORE's 80+ repos into "surface what matters for my current context". Everything becomes a typed, provenance-bearing graph node/edge; later phases rank them per (task, repo, role) and project the top-N into a generated APM package that compiles to AGENTS.md and every other harness.

Layout — APM monorepo-hybrid

mcp-servers/
  apm.yml                     # root marketplace manifest + local-path packages
  apm-policy.yml              # starter (tighten-only) org/company policy
  libs/
    score-context/            # shared, MCP-free Python ENGINE + Phase 0 schema
      src/score_context/schema/{nodes,edges,provenance}.py, context.jsonld
      src/score_context/delta.py
  packages/
    _template/                # copy-to-add-a-package skeleton (.apm/<type>/ dirs)
    context/                  # the attention layer AS an APM package
      apm.yml                 #   targets: copilot/claude/codex/cursor/gemini/opencode
      .apm/context/           #   generated attention output lands here (Phase 1+)
      .apm/skills/query-context/SKILL.md   # WIP stub

Adding an APM package = copy packages/_template, edit its apm.yml, drop primitives under .apm/<type>/. MCP servers are declarations under a package's dependencies.mcp: — not a separate directory. The engine is a shared lib in libs/, not fused into the package.

Schema (the substance)

Design principle: sphinx-needs is one signal source, not the foundation. Node vocabulary is split into two families:

  • Needs-model nodes — IDs reused verbatim from score_metamodel.yaml (stkh_req, feat_req, comp_req, feat, comp, mod, logical interfaces, dec_rec, safety/security analysis types, testcase, …). Not forked.
  • Trace/event nodes — the part deliberately outside the needs model, where most context change actually happens: issue, discussion, pull_request, commit, code_change, contract, repo, module, team, person, artifact, ci_result.

Edge relations are a superset: all needs_extra_links from the metamodel plus the ADR trace relations (affects, depends_on, discussed_in, blocks, supersedes, conflicts_with, authored_by, owns), with ADR_RELATION_MAPPINGS documenting the overlaps.

Invariants baked in now so adapters can't violate them later:

  • Natural keys only — need id / dec_rec id / org/repo#123 / commit sha / file path / bazel module label. No synthetic UUIDs.
  • Provenance mandatory on every node AND edge — {repo, sha?, adapter, confidence∈[0,1], observed_at}.
  • pydantic v2, extra="forbid" throughout.

context-delta — the one unit every future adapter emits

class ContextDelta:            # delta.py
    signal: Signal             # {type, source: SourceRef, provenance, weight, decays}
    graph_ops: list[GraphOp]   # discriminated union: UpsertNode | UpsertEdge

context.jsonld maps every node/edge type to a stable IRI under https://eclipse-score.github.io/context-attention/ns#.

Repo baseline & CI

Eclipse governance files added (modeled on eclipse-score/module_template, adapted to a uv/APM repo — no Bazel/sphinx scaffolding): LICENSES/Apache-2.0.txt + REUSE.toml (REUSE-compliant, reuse lint clean, 29/29 files), .github/CODEOWNERS, .github/dependabot.yml (github-actions/pip/pre-commit), CONTRIBUTION.md, .pre-commit-config.yaml (ruff + reuse).

First CI workflow .github/workflows/on-pr.yml:

  • reuses eclipse-score/cicd-workflows/.github/workflows/score-pr-checks.yml (pinned to 93aac16 / v0.0.2; skips Bazel-module check gracefully since there's no MODULE.bazel);
  • a local python-checks job running uv sync + ruff + pyright + pytest.
    All third-party actions/workflows are pinned to commit SHAs.

Verification

  • Python: uv sync, uv run ruff check ., ruff format --check, uv run pyright (0 errors), uv run pytest (4 passed) — all green.
  • APM CLI 0.26.0: apm pack --offline returns ok:true for the root marketplace, packages/context, and packages/_template; apm marketplace check --offline → all entries OK; apm doctor marketplace/version-alignment/duplicate-name checks pass. Generated output (.claude-plugin/, .github/, apm.lock.yaml, …) is gitignored, not committed.
  • Assisted by copilot

Frank Scholter Peres frank.scholter_peres@mercedes-benz.com, Mercedes-Benz Tech Innovation GmbH
Provider Information

FScholPer and others added 3 commits July 23, 2026 07:27
Signed-off-by: frank.scholter_peres <frank.scholter_peres@mercedes-benz.com>
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
…ed lib

Signed-off-by: frank.scholter_peres <frank.scholter_peres@mercedes-benz.com>
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Signed-off-by: frank.scholter_peres <frank.scholter_peres@mercedes-benz.com>
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@FScholPer FScholPer changed the title Add monorepo scaffold and Phase 0 context-attention schema Monorepo scaffold + Phase 0 schema for the Agent Context Attention Layer Jul 23, 2026
FScholPer and others added 3 commits July 23, 2026 08:30
Signed-off-by: frank.scholter_peres <frank.scholter_peres@mercedes-benz.com>
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Signed-off-by: frank.scholter_peres <frank.scholter_peres@mercedes-benz.com>
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Removed interim default owner from CODEOWNERS file.

Signed-off-by: Frank Scholter Peres(MBTI) <145544737+FScholPer@users.noreply.github.com>
@FScholPer
FScholPer marked this pull request as ready for review July 23, 2026 13:07
Signed-off-by: frank.scholter_peres <frank.scholter_peres@mercedes-benz.com>
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@FScholPer
FScholPer requested a review from AlexanderLanin July 23, 2026 13:22
Clarified the description of the context attention layer and its role in the repository.

Signed-off-by: Frank Scholter Peres(MBTI) <145544737+FScholPer@users.noreply.github.com>
@FScholPer
FScholPer merged commit 86985a8 into main Jul 27, 2026
3 checks passed
@FScholPer
FScholPer deleted the context-attention-phase0-schema branch July 27, 2026 12:38
FScholPer added a commit that referenced this pull request Oct 21, 2026
Fixes all 4 issues from PR #49 review:

Issue #1 (P1 - HIGH): Windows platform compatibility
- Move fcntl import to try/except with graceful fallback
- Add platform-compatible locking for Windows support
- Update build() to handle missing fcntl module

Issue #2 (P2 - MEDIUM): Extraction output directory
- Clear GRAPHIFY_OUT env var in graphify subprocess
- Prevents interference with --out flag
- Ensures correct output location

Issue #3 (P2 - MEDIUM): Cache path sharing with context-discipline
- Add resolve_graph_path() public function
- Update MergedGraph.build() to check user cache
- Update _graph_setup_status() to check user cache
- Both consumers now find cached graphs

Issue #4 (P2 - MEDIUM): Registry seeding race condition
- Add locking around registry seeding in prepare()
- Recheck graph existence after lock acquisition
- Prevents concurrent cold starts from corrupting cache

Add comprehensive test coverage:
- 7 new tests for resolve_graph_path()
- Test for GRAPHIFY_OUT env clearing
- Test for locking race condition prevention
- Total: 19 tests passing

Update documentation:
- Add resolve_graph_path() usage example to README
- Document programmatic access API

All code passes:
- Ruff linter (clean)
- Pyright type checker (0 errors)
- Pytest test suite (19/19 passing)
FScholPer added a commit that referenced this pull request Oct 22, 2026
* Serve graphify from a user cache seeded by central graphs

graphify-codegraph now prepares the graph before starting the server:
an existing graphify-out in the repository is used as is, otherwise the
graph lives under ~/.local/share/score-agent. For eclipse-score repos an
empty cache is seeded from ghcr.io/eclipse-score/mcp-servers/graphs
(merge-base, then main) with sha256 digest check, and a locked code-only
build refreshes it in the background when HEAD moved.

Co-Authored-By: frank.scholter_peres <frank.scholter_peres@mercedes-benz.com>

* fix(graphify-codegraph): address PR review issues

Fixes all 4 issues from PR #49 review:

Issue #1 (P1 - HIGH): Windows platform compatibility
- Move fcntl import to try/except with graceful fallback
- Add platform-compatible locking for Windows support
- Update build() to handle missing fcntl module

Issue #2 (P2 - MEDIUM): Extraction output directory
- Clear GRAPHIFY_OUT env var in graphify subprocess
- Prevents interference with --out flag
- Ensures correct output location

Issue #3 (P2 - MEDIUM): Cache path sharing with context-discipline
- Add resolve_graph_path() public function
- Update MergedGraph.build() to check user cache
- Update _graph_setup_status() to check user cache
- Both consumers now find cached graphs

Issue #4 (P2 - MEDIUM): Registry seeding race condition
- Add locking around registry seeding in prepare()
- Recheck graph existence after lock acquisition
- Prevents concurrent cold starts from corrupting cache

Add comprehensive test coverage:
- 7 new tests for resolve_graph_path()
- Test for GRAPHIFY_OUT env clearing
- Test for locking race condition prevention
- Total: 19 tests passing

Update documentation:
- Add resolve_graph_path() usage example to README
- Document programmatic access API

All code passes:
- Ruff linter (clean)
- Pyright type checker (0 errors)
- Pytest test suite (19/19 passing)

* fix: resolve CI formatting and type checking issues

- Apply ruff formatting to 4 Python files
- Fix unused variable warnings (document, graph1, graph2)
- Add type annotation for seeded list

* fix: prioritize in-repo graph over cache and report correct path

When no graph exists, report the in-repo path (graphify-out/graph.json)
instead of the user cache path. This matches user expectations and the
graphify-codegraph prepare() behavior.

Fixes test failures in test_initialize_session_reports_missing_graph_setup
and test_query_graph_reports_missing_graph_setup.
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.

2 participants