
Implementing NyxaLensAI: A Cross-Domain Architecture Review with AWS Step Functions and Amazon Bedrock
A practical walkthrough of NyxaLensAI’s request validation, parallel evidence pipeline, grounded synthesis, and scoring—plus the tradeoffs and limitations to check when building a similar AWS system. It includes runnable setup and verification steps, code examples, and visual guides.
AWS Community Builder, Test Architect, Multi-Hackathon Winner, Agentic AI Builder
Who this is for: builders who can run Python and read a service diagram, but do not need to know every AWS service already. You will trace one request from input validation to a grounded dossier, then open a hosted demo and run the code yourself.
Try it: the hosted demo shows three stored dossiers and needs no sign-in. The backend is deployed in my AWS account, but I am not publishing its scan endpoint: it has no authentication and each scan calls Amazon Bedrock. Source: github.com/sivasubramanian86/NyxaLensAI .

1. Opening hook: when a pattern name outran the code
While reviewing NyxaLensAI, I found a mismatch that could have made a neat demo less trustworthy.
The pattern corpus included a Schmitt trigger, a control-systems mechanism that uses different thresholds when a signal rises and falls. The name-collision handler was described as using hysteresis. Its code did not remember the previous result or use separate enter and exit thresholds. It compared each scan against fixed bands: RED for an exact match or similarity at least 0.88; YELLOW at 0.78 or above, for a phonetic match, or when a registry check was partial; GREEN otherwise.
The small distinction changed the claim. A stateless threshold can classify a name; it cannot prevent verdict flapping across scans. The analogy was useful as a design proposal, but describing it as implemented behavior would have been wrong. I checked the handler, corrected the wording, and kept the proposed mechanism separate from what the product currently does.
That is the problem this article tackles: architecture advice should expose its evidence and its limits. NyxaLensAI accepts a public GitHub repository or a Markdown RFC, gathers signals, and returns a dossier that a builder can challenge.
This is an implementation walkthrough, not a production case study. I deployed the backend to one AWS account and watched a handful of short RFC scans run end to end (two completed runs took 31 and 17 seconds). That is an observation, not a benchmark, and I have no cost measurements or user outcomes. The hosted demo serves stored dossiers, not live scans. Section 5 lists what broke on the first real deployment, because that is where the evidence is most useful.
2. What NyxaLensAI does
If you are deciding whether to build a component, reuse one, or change direction, a search result page is only the beginning. You still need to compare the proposal with existing projects, notice a name collision, and decide whether a mechanism from a different engineering field is actually relevant. NyxaLensAI combines those jobs into a reviewable Enhancement Dossier. It does not edit the repository it scans.
The input is either a public GitHub repository URL or RFC text. The output brings together three views:
- Name Collision Traffic Light: RED, YELLOW, or GREEN signals from GitHub, PyPI, and npm, plus alternative names. These are heuristic checks, not trademark clearance.
- Cross-Domain Analogy Card: a retrieved mechanism, the problem shape it addresses, a mapping to a repository component, its source, and an explicit warning. The system labels lift as
ESTIMATEDunless a real benchmark exists.
- Nyxa Score: a 0–100 composite with six rubric dimensions and a deterministic/rubric split. A projected score is a capped display estimate, not a forecast of user results.
The rest of the dossier contains a landscape report, KILL / KEEP / INJECT recommendations, a Mermaid before/after sketch, and up to five ranked actions. The core loop is SCAN → SITUATE → DIFFERENTIATE → ENHANCE → SCORE → ITERATE. “Enhance” means offer a recommendation; you decide whether to implement it. A later scan can reference its parent and display a score delta.

The builder submits input, reviews the dossier, makes changes independently, then rescans. Bundled demos follow the review path without calling AWS.
The project has three precomputed dossiers, so you can inspect the interface without cloud credentials. Live scans need the AWS backend, model access, and public upstream evidence sources. That separation matters: an offline fixture proves the page can render its sample data; it does not prove a Bedrock call or registry query works in your account.
3. How I built it—and how you can trace the implementation
The opening used “I” for the build story. This walkthrough addresses you directly, showing each boundary and its tradeoff.
Step 1: validate the request before starting work
The API should reject malformed input before it spends model tokens or starts a workflow. NyxaLensAI validates a Pydantic request and then enforces exactly one input at the HTTP boundary. That second check matters because the current shared model rejects a request with neither input, but permits both; the API route is what rejects the ambiguous case.
try: request = ScanRequest.model_validate(body)except ValidationError as exc: return _response(422, { "error": "Invalid scan request", "details": exc.errors(include_input=False), })
if bool(request.repo_url) == bool(request.rfc_text): return _response(422, { "error": "Provide exactly one of repo_url or rfc_text." })
This is the route’s real validation pattern from
lambdas/api_router/handler.py . The API also checks that a GitHub URL is public and accessible, normalizes the input, and includes the current commit SHA in the cache key. A completed result can be reused for 24 hours unless force_refresh is set. The cache query uses a DynamoDB global secondary index, which is eventually consistent; design the UI so a recent completion can briefly miss the cache rather than assuming the index is strongly consistent. DynamoDB documents this GSI consistency behavior .Step 2: let Step Functions coordinate evidence, not invent it
The orchestrator uses Nova Lite to build a typed
UniversalProjectProfile , then marks the record as DISCOVERING . AWS Step Functions is a workflow service: it tracks which task runs next and passes each task’s output onward. Its Parallel state starts branches concurrently and waits for all branches to finish before moving to the next state. That behavior fits this job because the four evidence lanes do not depend on one another, while synthesis needs their combined results. See the Step Functions Parallel state semantics .CDK encodes this fan-out and fan-in:
parallel_discovery = sfn.Parallel( self, "ParallelDiscoveryLanes", result_path="$.discovery")parallel_discovery.branch(repo_scanner_task)parallel_discovery.branch(name_collision_task)parallel_discovery.branch(landscape_task)parallel_discovery.branch(analogy_task)
definition = ( step_orchestrate .next(parallel_discovery) .next(step_synthesize))Each
branch is a Lambda task. Synthesis follows the parallel state so all evidence exists first. Topology: one orchestrator, four concurrent discovery Lambdas, one sequential synthesis Lambda. The Standard state machine has a 45-second configured timeout, not measured latency.

A self-created system diagram based on the CDK source. It describes intended deployment topology, not resources currently running in an AWS account. Amplify configuration exists; hosting is not connected.
The repo scanner reads a bounded selection of public repository files, uses Python’s standard-library
ast , and extracts JavaScript/TypeScript structure with regular expressions. The other lanes query GitHub/PyPI/npm, search GitHub and arXiv, and retrieve engineering patterns. Keep those lanes independent: if one external registry is slow, the name lane can report partial status without serializing every other lookup.Step 3: keep model calls behind one boundary
The shared Bedrock wrapper centralizes model IDs, request construction, and retry policy. The project uses the Converse API for text calls. The wrapper retries throttling and service-unavailable errors with exponential backoff; it does not retry every exception. That keeps validation and permission errors visible instead of disguising them as transient failures.
kwargs = { "modelId": model_id, "messages": messages, "inferenceConfig": {"maxTokens": max_tokens, "temperature": 0.1},}if system: kwargs["system"] = [{"text": system}]if tools: kwargs["toolConfig"] = {"tools": tools}
response = client.converse(**kwargs)For synthesis, the handler asks the model for a tool-use object and parses that input, with a text-to-JSON fallback. Pydantic validates the resulting dossier shape before persistence. The CDK stack uses Nova Lite for classification, Amazon Nova Pro for synthesis, and Titan Text Embeddings V2 for embeddings.
The synthesis model is a CDK context setting (
-c synthesis_model=... ), and it changed during deployment. I first targeted Claude 3.5 Sonnet v2, which had reached end of life in my account. I then tried Claude Sonnet 4.6 and Haiku 4.5, which worked in some calls and were rejected in others with a "use case details have not been submitted" error, and the Claude 5.5 models were not offered to my account at all. Nova Pro worked every time I called it, so it is the default. Check model access and lifecycle in your own account and region before you deploy. The Converse API provides a consistent message interface across supported Bedrock models .
The analogy lane first asks Nova Lite to remove domain-specific nouns from a problem signature. Titan turns the resulting sentence into a 1,024-dimensional embedding, then the handler searches OpenSearch Serverless or falls back to local vectors. Titan V2 supports 1,024 dimensions (as well as smaller dimensions); the model creates the vector, while the search store performs retrieval. AWS documents the embedding dimensions and retrieval use cases .

The AOSS path combines k-NN and lexical
multi_match ; it is not a calibrated relevance model. OpenSearch documents hybrid search configuration . The handler clamps _score to 0–1 and keeps a 0.72 cutoff for that path, while the local fallback uses cosine similarity with its own cutoff. Those two scores are on different scales, so they should not share a threshold. Either cutoff is a filter, not a confidence probability. CDK currently allows public network reachability and relies on an IAM data access policy, so restrict network access if you enable OpenSearch. OpenSearch is off by default because it carries a monthly minimum charge. Local vectors avoid it, but the analogy lane still calls Titan to embed each query.
My first local cutoff was 0.72, copied from the AOSS path, and it suppressed every analogy. Raw Titan cosine scores between a short query and these long pattern texts are low. In four probe queries, the correct pattern ranked first with scores of 0.29 to 0.34 (a "repeated failing tool calls" query put PAT-001 first, and a "slow service stalls the pipeline" query put PAT-004 first), while an off-topic query's best match scored 0.23. I set the local cutoff to 0.22. That is a preliminary choice from four queries, it sits below the off-topic score, and it will let weak matches through. It needs a labeled set before anyone should trust it.
One useful example is PAT-007, the Saga pattern with compensating transactions ( Garcia-Molina and Salem, SIGMOD 1987 ). For a workflow that reserves inventory, charges a card, then fails to reserve shipping, map compensations to refund the charge and release inventory. This is not atomic rollback: a refund can fail or arrive late. Make compensations idempotent and define who retries or escalates them. NyxaLensAI retrieves this as a design hypothesis; it does not install a Saga into the scanned repository.

AI-generated conceptual artwork. The analogy is a prompt for engineering review, not proof that two systems are equivalent.
Step 4: ground citations, then calculate the score in code
The model response is a draft, not evidence. The verifier extracts URLs from the draft and keeps only those found in raw evidence returned by the discovery lanes. It does not fetch the page again or prove the page’s claims. That distinction is important: verified here means provenance-checked against tool output, not independently fact-checked.
def _ground(value, allowed: set[str], removed: set[str]): if isinstance(value, dict): return {key: _ground(item, allowed, removed) for key, item in value.items()} if isinstance(value, list): return [_ground(item, allowed, removed) for item in value] if isinstance(value, str): def keep(match): url = match.group(0).rstrip(".,;:") if url in allowed: return match.group(0) removed.add(url) return "" return _url_re.sub(keep, value) return valueThen Python combines deterministic points with rubric scores. Deterministic maximum is 40: tests (8), nonzero dependency count with no duplicate names (6), citations (up to 8), README/core-module overlap (8), Mermaid graph heuristic (4), and GREEN name result (6). Rubric weights: clarity 15%, landscape 15%, originality 25%, gap opportunity 15%, enhancement 20%, evidence quality 10%. Python rounds the weighted average, scales it to 60%, rounds again, then adds deterministic points. Projected delta is clamped to 12–18 and capped at 100. Evidence quality is a rubric judgment; current code does not require a separate citation for every dimension.

Screenshot of the real Next.js dossier page, served locally from the checked-in Lumen Studio fixture. It is stored sample data, not a live scan. The fixture score is 32 deterministic + 46 rubric = 78; the displayed projection is 93.
The fixture makes the arithmetic reproducible: rubric scores 82, 72, 74, 76, 84, and 70 produce 77 before the 60% scale, then 46 rubric points; adding 32 deterministic points gives 78. The +15 projection comes from
round(84 × 0.18) , not from observed improvements after a real rescan. The dimensions are rubric judgments, not calibrated measurements across repository and RFC inputs.For example, a hypothetical best similarity score of 0.83 with no exact package match is YELLOW. An exact normalized name or score of 0.88 is RED; 0.78–0.87, phonetic evidence, or partial upstream checks are YELLOW; otherwise GREEN. Timeout cannot look like a clean pass. This is stateless per scan; Schmitt-trigger hysteresis remains an idea, not current behavior. Treat every result as a naming signal, not legal clearance.
Step 5: surface progress without coupling the UI to the worker
POST /scans writes an INITIALIZED item, starts Step Functions, then returns a scan ID. Next.js polls GET /scans/{scan_id} every 1.5 seconds. Each poll is a read, so measure traffic before scaling this delivery pattern. The API also returns an SVG badge and parent scan score delta.The repository includes three offline dossier fixtures. The frontend can render those without an API URL, which makes visual review and UI tests possible without AWS. Those fixtures do not simulate the live worker calls; the test suite separately mocks service responses and exercises pipeline handlers.
4. The experience: the useful “aha”
The most enjoyable moment was not a model producing an unexpected analogy. It was seeing a failure shape survive translation. A target project may call something a “tool loop”; a distributed-systems designer may recognize a sequence of local commits with compensating actions. If the dossier can show the source mechanism, the target module, the expected effect, and the anti-pattern warning together, you can challenge the mapping instead of accepting an impressive phrase.
The offline Lumen Studio fixture is how I demonstrate the intended experience without pretending there is a live service: it includes a GREEN heuristic name result, four verified source URLs, a PAT-017 card, and a score of 78. The fixture tests validate that dossier against the same Pydantic schema and re-calculate the score components. That proves the sample is internally consistent. It does not prove the pattern is right for a real application, that four citations are sufficient, or that the projection will happen after a change.
I have no user-feedback sample, production traces, deployed API, or measured model costs yet. The useful result today is a traceable local slice and a set of mismatches that can be inspected. I would rather show that boundary than borrow credibility from a cloud architecture diagram.
5. Proof it works: run the local path
Use Python 3.12 and Node 22. From the repository root, install dependencies and run checks:
python -m pip install -r cdk/requirements.txt -r lambdas/requirements.txt requests pytest pytest-asyncio pytest-mock ruff==0.15.12python -m pytest tests/unit tests/integration -qpython -m ruff check lambdas data testscd frontendnpm cinpm test -- --cinpm run buildOn my machine, 104 Python tests and five Jest tests pass. The source is public at github.com/sivasubramanian86/NyxaLensAI , so you can clone it and run these commands yourself. To open the app locally, run
npm run dev in frontend/ and choose one of the three demos.Deploying it
From
cdk/ , run npx --yes aws-cdk@2 bootstrap once, then npx --yes aws-cdk@2 deploy . The stack bundles Lambda code locally with pip (Linux wheels), so Docker is not required, and it falls back to Docker only if that fails. OpenSearch Serverless is off unless you pass -c enable_aoss=true , because it carries a monthly minimum charge. Everything else is pay-per-request, so an idle stack costs close to nothing. The API stage is throttled to 2 requests per second because the API has no authentication and every scan calls Bedrock.The hosted demo is a static export of the Next.js app, published to AWS Amplify Hosting by direct upload with
scripts/deploy_demo_frontend.ps1 . It needs no server and no GitHub connection.What broke on the first real deployment
The mocked tests passed before I deployed. These are the failures that only appeared against real AWS, in the order I hit them:
Symptom | Cause | Fix |
|---|---|---|
CloudFormation validation warned of a circular dependency | One shared Lambda role was granted StartExecution on a state machine whose own role depends on those Lambdas | Gave the API router its own role |
GET /scans/{id} returned 502 | DynamoDB returns numbers as Decimal , which json.dumps cannot serialize | Added a JSON encoder for Decimal |
A failed scan could not even record its failure | status and error are DynamoDB reserved words in an UpdateExpression , so the failure handler itself threw and hid the real error | Aliased both with ExpressionAttributeNames |
Every RFC was named "Untitled RFC" | The model's reply was not bare JSON, so parsing failed and the fallback ran. After I extracted the first {…} block, the name came back correctly | Parse the JSON object out of the reply |
No analogies were ever returned | The 0.72 cutoff exceeded every real Titan score (see Step 3) | Calibrated a separate local cutoff |
The analogy lane crashed once matches passed the cutoff | The corpus nests the design under transferable_design , but the output schema expects flat fields. It had never run against the real corpus because the cutoff dropped everything first | Flattened corpus records into the schema |
Each fix has a regression test, which is why the count is 104 and not 89.
One failure is not fixed. In a later run, a discovery lane returned a result larger than the Step Functions 256 KB limit and the scan failed. From the execution history I believe it was the repo scanner, but I have not root-caused it, so I would not call this pipeline reliable yet.
6. What I learned
I learned to separate three things that are easy to collapse into one polished score: what a parser observed, what a model inferred, and what a source actually supports. Pydantic validates shape, not truth. A URL allowlist verifies where a citation came from, not whether it is current. A high rubric score is still a judgment unless it is calibrated against examples and reviewed by people who understand the domain.
I also learned that cross-domain retrieval needs a narrow intermediate representation. “Apply telecom patterns” is too broad. State space, bottleneck, failure mode, and consistency model give retrieval a more useful target. The 20-record corpus is a starting point, not a moat until sources and mappings survive expert review. A technically plausible analogy still needs an engineer to decide whether its assumptions hold in the target system.
The biggest lesson was that mocks agreed with my code, not with AWS. Six separate defects survived a green test suite, and a real deployment found all of them in about an hour. I would now deploy a thin end-to-end slice first and write the mocks afterward.
If I extend this, I would build a labeled set of retrieval examples before trusting the 0.22 local cutoff, fix the oversized lane result, calibrate scores separately for repository and RFC inputs, and either implement true stateful hysteresis or keep the name result explicitly stateless. I would also normalize and evaluate AOSS and local similarity scores on the same labeled set. Those changes follow from the code paths above; none is a benchmark result I can claim today.
7. Educational disclaimer
NyxaLensAI is an educational architecture-review aid. Name checks are not legal advice; similarity scores, analogy matches, citations, and lift projections require human review and are not guarantees or empirical benchmarks.
Enjoyed reading this content? Let the author know!
Your likes, comments, shares, and saves help creators reach more builders.
Loading recommendations
Loading article