Co-founder & CTO · June 2023 to present
DigiLawyer
Engineering reliable legal AI for Pakistani law: keeping execution recoverable, sources inspectable and access boundaries explicit.
DigiLawyer is a legal research and AI platform. I’m Muhammad Safee Ullah. my legal employer is Codxperts Solutions. This case study covers systems I have worked on as part of the team, rather than claiming sole ownership of the product.
23,000+ registered users, based on 23,759 Clerk registered accounts as of October 21, 2026.
This is a registration count, not a measure of active usage.
Visit DigiLawyer ↗Updated
Resilient chat delivery
A dropped connection leaves an ambiguous result: did the request fail, or did the response stop reaching the browser? Retrying without resolving that ambiguity can duplicate work.
My work covers idempotent retries, resumable streams and checkpointed execution. These address separate concerns: accepting a request again safely, recovering delivery, and preserving execution progress.
Recovery adds state and failure paths to maintain. The useful distinction is between reconnecting to output and restarting work. Stream recovery alone does not make every action safe to repeat.
Durable agents and human intervention
An agent workflow may outlive a browser connection or pause for a person. A pause needs enough execution context to continue without treating the response as a new conversation.
I work on LangGraph agent orchestration with resumable human-in-the-loop execution. The engineering focus is execution state: what has completed, what is waiting for input, and what can continue.
Explicit orchestration makes state transitions easier to inspect, but introduces persistence and recovery decisions. A checkpoint is useful only alongside a clear account of which actions have already happened.
Evaluation before release
A fluent legal answer can still contain an invalid citation or follow the wrong path. A model judging its own output is not enough evidence of correctness.
My evaluation work includes deterministic checks, fail-closed evaluation and model comparisons. Deterministic validation covers properties that can be checked directly; model-based assessment addresses questions that require judgment. In the evaluation harness, malformed judge responses and transport failures produce an inconclusive result, which does not count as a pass.
A failed or unreadable evaluation must not become a passing result. Quality, cost and the limits of each check belong in model comparisons. No single score establishes that a legal workflow is ready to ship.
Retrieval that keeps legal sources inspectable
Legal research needs both exact references and passages that express a related idea in different words. Either kind of match can be missed when search relies on a single signal.
My retrieval work spans PostgreSQL, pgvector, ParadeDB/BM25, citation boosting and reranking. Exact text, semantic similarity and citation signals offer different ways to identify useful sources.
Combining signals introduces ranking choices and more stages to evaluate. Reranking can reorder retrieved candidates; it cannot recover an authority that never entered the candidate set. Sources must remain inspectable alongside the answer.
Authenticated MCP integration
Connecting an AI client to legal tools introduces an authorization boundary. A tool being discoverable does not mean a caller should be able to use it or access every resource behind it.
I work on authenticated Model Context Protocol (MCP) integration with OAuth and PKCE. The focus is connecting clients to capabilities with an authenticated user context.
A standard protocol improves interoperability while adding consent and credential lifecycle concerns. Authentication establishes who is calling; resource authorization remains a separate responsibility.
What connects this work
The recurring engineering lesson is to make failure and uncertainty explicit. Delivery can fail while execution continues. An evaluation can fail without proving an answer wrong or right. A relevant source can still be outside a caller’s access. Each boundary needs its own state and checks.
This overview describes the scope of my work and its design concerns. It does not report benchmarks, comparative wins or deployment guarantees. Detailed implementation accounts need separate evidence and review before publication.